Message
All of the things you type and send will be messages
Field
Field
Description
.Message.ID
ID of the message.
.Message.ChannelID
Channel ID this message is in.
.Message.GuildID
Guild ID in which the message is.
.Message.Content
Text content on this message.
.Message.Timestamp
Timestamp of the message in type discordgo.Timestamp (use .Message.Timestamp.Parse to get type time.Time and .Parse.String method returns type string).
.Message.EditedTimestamp
The time at which the last edit of the message occurred, if it has been edited.
.Message.MentionRoles
The roles mentioned in the message.
.Message.MentionEveryone
Whether the message mentions everyone.
.Message.Author
.Message.Attachments
Attachments to this message (slice of attachment objects).
.Message.Embeds
Embeds on this message (slice of embed objects).
.Message.Mentions
Users this message mentions.
.Message.Reactions
Reactions on this message (only available from getMessage).
.Message.Type
.Message.Pinned
Whether this message is pinned.
.Args
.Cmd
.CmdArgs
.StrippedMsg
Example:
We will demonstrate
.Args
,.Cmd
,.CmdArgs
, and.StrippedMsg
.
Message object in Discord documentation (read it if you want to write complex codes).
More Info
You can fetch a message by ID or use the trigger message and get some information about it. Message returns the following things that you can access with it:
Field
Type
.Message.ID
Int
.Message.ChannelID
Int
.Message.Author
.Message.Timestamp
String
.Message.Attachments
.Message.Embeds
Array of Embed
.Message.Mentions
.Message.Reactions
.Message.Content
String
Attachment
Either starts with (index .Message.Attachments 0).
or a variable with the attachment type.
Field
Type
Description
ID
Int
The ID of the attachment
URL
String
cdn.discordapp.com URL
ProxyURL
String
media.discordapp.com URL
Filename
String
Filename of the attachment
Width
Int
Width of the attachment (if image) in pixels
Height
Int
Height of the attachment (if image) in pixels
Size
Int
Size of the attachment in bytes
Reaction
Either starts with (index .Message.Reactions 0)
or a variable with the reaction type.
Field
Type
Description
Count
Int
Times this emoji has been used to react
Emoji
The emoji used in the reaction
Emoji
Either starts with (index .Message.Reactions 0).Emoji
or a variable of the reaction type.
Field
Type
Description
ID
Int
ID of the emoji
Name
String
Name of the emoji (if Unicode emoji this will be the emote)
Animated
Boolean
Whether the emoji is animated or not
There are more fields which can be used, but they are either obsolete or only used with Global Emotes.
Example to fetch the name of the first reaction on a message provided through the getMessage
template:
Last updated
Was this helpful?