Message class

Message structure

content, embeds, attachments, and components will require a privileged intent in 2022. Learn more here.

https://discord.com/developers/docs/resources/channel#message-object-message-structure

Annotations
  • @JsonSerializable(includeIfNull: false)

Constructors

Message({required String id, required String channelId, String? guildId, required User author, GuildMember? member, required String content, required DateTime timestamp, DateTime? editedTimestamp, required bool tts, required bool mentionEveryone, required List<User> mentions, required List<String> mentionRoles, List<ChannelMention>? mentionChannels, required List<Attachment> attachments, required List<Embed> embeds, List<Reaction>? reactions, dynamic nonce, required bool pinned, String? webhookId, required MessageType type, MessageActivity? activity, Application? application, String? applicationId, MessageReference? messageReference, List<MessageFlag>? flags, Message? referencedMessage, MessageInteraction? interaction, Channel? thread, List<Component>? components, List<Sticker>? stickerItems})
array of sticker objects Constructor
Message.fromJson(Map<String, dynamic> json)
From json
factory

Properties

activity MessageActivity?
sent with Rich Presence-related chat embeds
final
application Application?
sent with Rich Presence-related chat embeds
final
applicationId String?
if the message is a response to an Interaction, this is the id of the interaction's application
final
attachments List<Attachment>
any attached files
final
author User
the author of this message (not guaranteed to be a valid user, see below)
final
channelId String
id of the channel the message was sent in
final
components List<Component>?
sent if the message contains components like buttons, action rows, or other interactive components
final
content String
contents of the message
final
editedTimestamp DateTime?
when this message was edited (or null if never)
final
embeds List<Embed>
any embedded content
final
flags List<MessageFlag>?
message flags combined as a bitfield
final
guildId String?
id of the guild the message was sent in
final
hashCode int
The hash code for this object.
no setterinherited
id String
id of the message
final
interaction MessageInteraction?
sent if the message is a response to an Interaction
final
member GuildMember?
member properties for this message's author
final
mentionChannels List<ChannelMention>?
channels specifically mentioned in this message
final
mentionEveryone bool
whether this message mentions everyone
final
mentionRoles List<String>
roles specifically mentioned in this message
final
mentions List<User>
users specifically mentioned in the message
final
messageReference MessageReference?
data showing the source of a crosspost, channel follow add, pin, or reply message
final
nonce → dynamic
used for validating a message was sent
final
pinned bool
whether this message is pinned
final
reactions List<Reaction>?
reactions to the message
final
referencedMessage Message?
the message associated with the message_reference
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stickerItems List<Sticker>?
sent if the message contains stickers
final
thread Channel?
the thread that was started from this message, includes thread member object
final
timestamp DateTime
when this message was sent
final
tts bool
whether this was a TTS message
final
type MessageType
type of message
final
webhookId String?
if the message is generated by a webhook, this is the webhook's id
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
To json
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited