bot.utils.messages
#
Message utilities.
Module Contents#
Functions#
|
Return a string for user which has their mention and ID. |
|
Attempt to convert a given text to a discord Message object and return it. |
|
Attempt to extract the text and embed from a possible link to a discord Message. |
|
Convert the text in an embed using a given conversion function, then return the embed. |
- bot.utils.messages.format_user(user: discord.abc.User) str [source]#
Return a string for user which has their mention and ID.
- async bot.utils.messages.get_discord_message(ctx: discord.ext.commands.Context, text: str) discord.Message | str [source]#
Attempt to convert a given text to a discord Message object and return it.
Conversion will succeed if given a discord Message ID or link. Returns text if the conversion fails.
- async bot.utils.messages.get_text_and_embed(ctx: discord.ext.commands.Context, text: str) tuple[str, discord.Embed | None] [source]#
Attempt to extract the text and embed from a possible link to a discord Message.
Does not retrieve the text and embed from the Message if it is in a channel the user does not have read permissions in.
- Returns a tuple of:
str: If text is a valid discord Message, the contents of the message, else text. Optional[Embed]: The embed if found in the valid Message, else None
- bot.utils.messages.convert_embed(func: collections.abc.Callable[[str], str], embed: discord.Embed) discord.Embed [source]#
Convert the text in an embed using a given conversion function, then return the embed.
Only modifies the following fields: title, description, footer, fields