Skip to content

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:

send async

Sends a new message to the current channel.

Permissions
  • SEND_MESSAGES → required to senf your own messages

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.

Permissions
  • MANAGE_MESSAGES → ONLY if editing another user's 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.

Permissions
  • SEND_MESSAGES → required to send the message

Parameters:

crosspost async

Crosspost this message in an Annoucement channel to all following channels.

Permissions
  • SEND_MESSAGES → required to publish your own messages
  • MANAGE_MESSAGES → required to publish messages from others

Returns:

  • Message

    the published (crossposted) message

delete async

Deletes this message.

add_reaction async

Add a reaction from this message.

Permissions
  • READ_MESSAGE_HISTORY → required to view message
  • ADD_REACTIONS → required to create reaction

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.

Permissions
  • MANAGE_MESSAGES → required to remove another user's reaction

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.

Permissions
  • MANAGE_MESSAGES → required to remove all reaction

pin async

Pin this message to its channel's pins.

unpin async

Unpin this message from its channel's pins.