Message Resource¶
Note
The following classes come from the discord.resources.message
module.
Message
dataclass
¶
Bases: DataModel
A Discord message.
id: int
instance-attribute
¶
ID of the message
channel_id: int
instance-attribute
¶
Channel ID of the message.
author: UserModel = None
class-attribute
instance-attribute
¶
User data of author of the message.
content: str = None
class-attribute
instance-attribute
¶
Content of the message.
pinned: bool = None
class-attribute
instance-attribute
¶
If the message is pinned.
webhook_id: Optional[int] = None
class-attribute
instance-attribute
¶
ID of the webhook if the message is a webhook.
fetch
async
¶
Fetches the message data based on the given channel id and message id.
Returns:
-
Message
–the message object
send
async
¶
Sends a new message to the current channel.
Parameters:
-
message
(str | MessageBuilder
) –can be just text or the MessageBuilder for dynamic messages
Returns:
-
Message
–the new Message object with all fields populated
edit
async
¶
Edits this message.
Parameters:
-
message
(str | MessageBuilder
) –can be just text or the MessageBuilder for dynamic messages
reply
async
¶
Reply to this message with a new message.
Parameters:
-
message
(str | MessageBuilder
) –the new message
crosspost
async
¶
Crosspost this message in an Annoucement channel to all following channels.
Returns:
-
Message
–the published (crossposted) message
delete
async
¶
Deletes this message.
add_reaction
async
¶
Add a reaction from this message.
Parameters:
-
emoji
(EmojiModel | str
) –the standard emoji (str) or custom emoji (EmojiModel)
remove_reaction
async
¶
Remove the bot's reaction from this message.
Parameters:
-
emoji
(EmojiModel | str
) –the standard emoji (str) or custom emoji (EmojiModel)
remove_user_reaction
async
¶
Remove a specific user's reaction from this message.
Parameters:
-
emoji
(EmojiModel | str
) –the standard emoji (str) or custom emoji (EmojiModel)
-
user_id
(int
) –user's ID
remove_all_reactions
async
¶
Clear all reactions from this message.
pin
async
¶
Pin this message to its channel's pins.
unpin
async
¶
Unpin this message from its channel's pins.