DiscordMessage

constructor(id: Snowflake, channelId: Snowflake, guildId: OptionalSnowflake = OptionalSnowflake.Missing, author: DiscordUser, member: Optional<DiscordGuildMember> = Optional.Missing(), content: String, timestamp: Instant, editedTimestamp: Instant?, tts: Boolean, mentionEveryone: Boolean, mentions: List<DiscordOptionallyMemberUser>, mentionRoles: List<Snowflake>, mentionedChannels: Optional<List<DiscordMentionedChannel>> = Optional.Missing(), attachments: List<DiscordAttachment>, embeds: List<DiscordEmbed>, reactions: Optional<List<Reaction>> = Optional.Missing(), nonce: Optional<@Serializable(with = LongOrStringSerializer::class) String> = Optional.Missing(), pinned: Boolean, webhookId: OptionalSnowflake = OptionalSnowflake.Missing, type: MessageType, activity: Optional<MessageActivity> = Optional.Missing(), application: Optional<MessageApplication> = Optional.Missing(), applicationId: OptionalSnowflake = OptionalSnowflake.Missing, messageReference: Optional<DiscordMessageReference> = Optional.Missing(), flags: Optional<MessageFlags> = Optional.Missing(), stickers: Optional<List<DiscordStickerItem>> = Optional.Missing(), referencedMessage: Optional<DiscordMessage?> = Optional.Missing(), roleSubscriptionData: Optional<RoleSubscription> = Optional.Missing(), components: Optional<List<DiscordComponent>> = Optional.Missing(), interaction: Optional<DiscordMessageInteraction> = Optional.Missing(), thread: Optional<DiscordChannel> = Optional.Missing(), position: OptionalInt = OptionalInt.Missing)(source)

Parameters

id

id of the message.

channelId

id of the channel the message was sent in.

guildId

id of the guild the message was sent in.

author

The author of this message.

The author is only a valid user in the case where the message is generated by a user or bot user.

If the message is generated by a webhook, the author object corresponds to the webhook's DiscordWebhook.id, DiscordWebhook.name, and DiscordWebhook.avatar. You can tell if a message is generated by a webhook by checking for the webhookId on the message object.

member

Member properties for this message's author.

It only exists in MESSAGE_CREATE and MESSAGE_UPDATE events from text-based guild channels.

content

Contents of the message.

editedTimestamp

When this message was edited, null if never.

tts

Whether this was a text-to-speech message.

mentionEveryone

Whether this message mentions everyone.

mentions

Users specifically mentioned in the message.

mentionRoles

Roles specifically mentioned in this message.

mentionedChannels

Channels specifically mentioned in this message.

Not all channel mentions in a message will appear in mentionedChannels:

  • Only textual channels that are visible to everyone in a lurkable guild will ever be included.

  • Only crossposted messages (via Channel Following) currently include mentionedChannels at all.

If no mentions in the message meet these requirements, this field will not be sent.

attachments

Any attached files.

embeds

Any embedded content.

reactions

reactions to the message.

nonce

Used for validating a message was sent.

pinned

Whether this message is pinned.

webhookId

If the message is generated by a webhook, this is the webhook's id.

type

Type of message.

activity

Sent with Rich Presence-related chat embeds.

application

Sent with Rich Presence-related chat embeds.

messageReference

Reference data sent with crossposted messages and replies.

flags

Message flags.

stickers

The stickers sent with the message (bots currently can only receive messages with stickers, not send).

referencedMessage

the message associated with messageReference.

roleSubscriptionData

RoleSubscription object data of the role subscription purchase or renewal that prompted this message.

applicationId

if the message is a response to an Interaction, this is the id of the interaction's application

components

a list of components which have been added to this message