Message
Represents a message from Discord.Attributes
The message ID.
The actual contents of the message.
A
Member that sent the message. If channel is a private channel or the user has left the guild, then it is a User instead.The
TextChannel or Thread that the message was sent from. Could be a DMChannel or GroupChannel if it’s a private message.The guild that the message belongs to, if applicable.
The message’s creation time in UTC.
An aware UTC datetime object containing the edited time of the message.
Specifies if the message was done with text-to-speech. This can only be accurately received in
on_message due to a Discord limitation.The type of message. In most cases this should not be checked, but it is helpful in cases where it might be a system message.
Specifies if the message mentions everyone.
This does not check if the @everyone or @here text is in the message itself. Rather this boolean indicates if either the @everyone or the @here text is in the message and it did end up mentioning.
A list of
Member that were mentioned. If the message is in a private message then the list will be of User instead.A list of
GuildChannel that were mentioned. If the message is in a private message then the list is always empty.A list of
Role that were mentioned. If the message is in a private message then the list is always empty.A list of embeds the message has.
A list of attachments given to a message.
Reactions to a message. Reactions can be either custom emoji or standard unicode emoji.
Specifies if the message is currently pinned.
Extra features of the message.
The message that this message references. This is only applicable to messages of type
MessageType.pins_add, crossposted messages created by a followed channel integration, or message replies.A list of sticker items given to the message.
A list of components in the message.
The thread created from this message, if applicable.
Returns a URL that allows the client to jump to this message.
The poll associated with this message, if applicable.
Methods
async reply(content, **options)
async reply(content, **options)
Replies to the message.Returns:
The content of the message to send.
The rich embed for the content.
Whether to mention the author of the message being replied to. Defaults to True.
A Discord UI View to add to the message.
Message - The message that was sent.Example:async edit(content=None, **options)
async edit(content=None, **options)
Edits the message.Returns:
The message must be authored by the bot user.
The new content to replace the message with.
The new embed to replace the original with.
The new embeds to replace the original with. Must be a maximum of 10.
A list of attachments to keep in the message. If [] is passed then all attachments are removed.
The updated view to update this message with.
Message - The newly edited message.Example:async delete(delay=None)
async delete(delay=None)
Deletes the message.Example:
If provided, the number of seconds to wait before deleting the message.
async add_reaction(emoji)
async add_reaction(emoji)
Adds a reaction to the message.Example:
The emoji to react with.
async remove_reaction(emoji, member)
async remove_reaction(emoji, member)
async clear_reactions()
async clear_reactions()
Removes all reactions from the message.Example:
You need the
manage_messages permission to use this.async pin(reason=None)
async pin(reason=None)
Pins the message.Example:
You must have the
manage_messages permission to do this.The reason for pinning the message. Shows up on the audit log.
async unpin(reason=None)
async unpin(reason=None)
Unpins the message.Example:
You must have the
manage_messages permission to do this.The reason for unpinning the message. Shows up on the audit log.
async create_thread(name, **options)
async create_thread(name, **options)
Creates a thread from this message.Returns:
The name of the thread.
The duration in minutes before a thread is automatically archived for inactivity.
Specifies the slowmode rate limit for users in this thread, in seconds.
Thread - The created thread.Example:to_reference()
to_reference()
Creates a
MessageReference from the current message.Returns: MessageReference - The reference to this message.Example:Attachment
Represents an attachment from Discord.Attributes
The attachment ID.
The attachment’s filename.
The attachment URL. If the message this attachment was attached to is deleted, then this will 404.
The attachment size in bytes.
The attachment’s height, in pixels. Only applicable to images and videos.
The attachment’s width, in pixels. Only applicable to images and videos.
The attachment’s media type.
The attachment’s description.
Methods
async save(fp, **options)
async save(fp, **options)
async read()
async read()
Retrieves the content of this attachment as a bytes object.Returns:
bytes - The contents of the attachment.Example:async to_file()
async to_file()
Converts the attachment into a
File suitable for sending via send().Returns: File - The attachment as a file suitable for sending.Example:is_spoiler()
is_spoiler()
Whether this attachment contains a spoiler.Returns:
bool - True if the filename starts with “SPOILER_”.