provide an extra method for helping wor with embed_requested (#1558)

This commit is contained in:
Michael H 2018-05-04 02:16:24 -04:00 committed by Kowlin
parent ee7b0cf730
commit dd4cd0eeb1

View File

@ -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)