mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 03:08:55 -05:00
provide an extra method for helping wor with embed_requested (#1558)
This commit is contained in:
parent
ee7b0cf730
commit
dd4cd0eeb1
@ -137,3 +137,32 @@ class RedContext(commands.Context):
|
||||
return await self.bot.embed_requested(
|
||||
self.channel, self.author, command=self.command
|
||||
)
|
||||
|
||||
async def maybe_send_embed(self, message: str) -> discord.Message:
|
||||
"""
|
||||
Simple helper to send a simple message to context
|
||||
without manually checking ctx.embed_requested
|
||||
This should only be used for simple messages.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
message: `str`
|
||||
The string to send
|
||||
|
||||
Returns
|
||||
-------
|
||||
discord.Message:
|
||||
the message which was sent
|
||||
|
||||
Raises
|
||||
------
|
||||
discord.Forbidden
|
||||
see `discord.abc.Messageable.send`
|
||||
discord.HTTPException
|
||||
see `discord.abc.Messageable.send`
|
||||
"""
|
||||
|
||||
if await self.embed_requested():
|
||||
return await self.send(embed=discord.Embed(description=message))
|
||||
else:
|
||||
return await self.send(message)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user