Message¶
Inherits: TextChannel < TextChannel.BaseMessage < Channel < MentionableEntity < DiscordEntity < Reference < Object
Inherited By: GuildMessage
Description¶
Represents a message sent in a channel within Discord.
Properties¶
Methods¶
| return type | signature |
|---|---|
| User | get_author ( ) |
| Message | get_referenced_message ( ) |
| MessageEditAction | edit ( ) |
| Message | fetch ( ) coroutine |
| Message | fetch_referenced_message ( ) coroutine |
| MessageCreateAction | reply ( String with_content="" ) |
| bool | react ( Emoji emoji ) coroutine |
| bool | unreact ( Emoji emoji ) coroutine |
| bool | remove_reaction ( int user_id, Emoji emoji ) coroutine |
| Array | fetch_reactions ( Emoji emoji, int after=0, int limit=25 ) coroutine |
| void | clear_all_reactions ( ) coroutine |
| void | clear_emoji_reactions ( Emoji emoji ) coroutine |
| bool | delete ( ) coroutine |
Constants¶
-
Dictionary Type
-
DEFAULT = 0
-
RECIPIENT_ADD = 1
-
RECIPIENT_REMOVE = 2
-
CALL = 3
-
CHANNEL_NAME_CHANGE = 4
-
CHANNEL_ICON_CHANGE = 5
-
CHANNEL_PINNED_MESSAGE = 6
-
GUILD_MEMBER_JOIN = 7
-
GUILD_SUBSCRIPTION = 8
-
GUILD_SUBSCRIPTION_TIER_1 = 9
-
GUILD_SUBSCRIPTION_TIER_2 = 10
-
GUILD_SUBSCRIPTION_TIER_3 = 11
-
CHANNEL_FOLLOW_ADD = 12
-
GUILD_DISCOVERY_DISQUALIFIED = 14
-
GUILD_DISCOVERY_REQUALIFIED = 15
-
GUILD_DISCOVERY_GRACE_PERIOD_INITIAL_WARNING = 16
-
GUILD_DISCOVERY_GRACE_PERIOD_FINAL_WARNING = 17
-
THREAD_CREATED = 18
-
REPLY = 19
-
APPLICATION_COMMAND = 20
-
THREAD_STARTER_MESSAGE = 21
-
GUILD_INVITE_REMINDER = 22
-
CONTEXT_MENU_COMMAND = 23
Message types.
-
-
Dictionary Flags
-
CROSSPOSTED = 1
-
IS_CROSSPOST = 2
-
SUPPRESS_EMBEDS = 4
-
SOURCE_MESSAGE_DELETED = 8
-
URGENT = 16
-
HAS_THREAD = 32
-
EPHEMERAL = 64
-
LOADING = 128
Message flags.
-
Property Descriptions¶
-
int author_id
The author's id of this message.
-
User author
method Getter get_author() The author of this message.
-
int timestamp
When this message was sent in unix time in seconds.
-
int type
Type of message.
-
String content
Contents of the message.
-
int edited_timestamp
When this message was edited (or
0if never).
-
Array mentions
List of
Users mentioned in the message.
-
Array channel_mentions
List of
ChannelMentionobjects in this message.
-
Array attachments
List of
MessageAttachmentobjects.
-
Array embeds
List of
MessageEmbedobjects.
-
Array reactions
List of
MessageReactionobjects attached to the message.
-
String nonce
There is currently no description for this property.
-
bool is_pinned
Whether this message is pinned.
-
int webhook_id
Webhook's id if the message is from a webhook.
-
DiscordWebhook webhook
Webhook object reference if the message is fro ma webhook.
-
MessageActivity activity
Present with Rich Presence-related chat embeds.
-
DiscordApplication application
Present with Rich Presence-related chat embeds.
-
int application_id
The id of the application, if the message is an interaction or application-owned webhook.
-
BitFlag flags
The message
Flags.
-
MessageReference message_reference
Contains information on the referenced message such in replies and cross posts.
-
int referenced_message_id
The
reference_messageid.
-
Message referenced_message
method Getter get_referenced_message() The message associated with the
message_reference.
-
MessageInteraction interaction
There is currently no description for this property.
-
Array components
List of
MessageComponentobjects attached to the message.
-
Array sticker_items
List of
MessageStickerobjects attached to the message.
Method Descriptions¶
-
User get_author ( )
authorgetter.
-
Message get_referenced_message ( )
referenced_messagegetter.
-
MessageEditAction edit ( )
Edits the message, the messge author must be same bot user.
-
Message fetch ( ) coroutine
Fetches the message from Discord API.
-
Message fetch_referenced_message ( ) coroutine
Fetches the referenced message if there is any from Discord API.
-
MessageCreateAction reply ( String with_content="" )
Create a reply to this message.
-
bool react ( Emoji emoji ) coroutine
Reacts to the message with
emoji. Requires bot to haveADD_REACTIONSpermission in guild channels.
-
bool unreact ( Emoji emoji ) coroutine
Removes the
emojireaction from the message.
-
bool remove_reaction ( int user_id, Emoji emoji ) coroutine
Removes a user reactions from the message. Requires the bot to have
MANAGE_MESSAGESpermission.
-
Array fetch_reactions ( Emoji emoji, int after=0, int limit=25 ) coroutine
Fetches the
emojireactions from Discord API. Requires the bot to haveMANAGE_MESSAGESpermission
-
void clear_all_reactions ( ) coroutine
Removes all reactions from the message. Requires the bot to have
MANAGE_MESSAGESpermission
-
void clear_emoji_reactions ( Emoji emoji ) coroutine
Removes all
emojireactions from the message.
-
bool delete ( ) coroutine
Deletes the message if the author is the same bot user. If the message is inside a guild channel, the bot must have
MANAGE_MESSAGESpermission to delete other members messages.