Message class
Represents a message sent in a TextChannel.
Not all messages are sent by users. Messages can also be system messages such as the "message pinned" notice that is sent to a channel when a message is pinned. Check type to see if a message is MessageType.normal or MessageType.reply.
External references:
- Discord API Reference: https://discord.com/developers/docs/resources/channel#message-object
- Inheritance
Properties
- activity → MessageActivity?
-
Activity information if this message is related to Rich Presence,
null
otherwise.final - application → PartialApplication?
-
The application associated with this message if this messages is related to Rich Presence,
null
otherwise.final - applicationId → Snowflake?
-
The ID of the Application that sent this message if it is an interaction or a webhook,
null
otherwise.final -
attachments
→ List<
Attachment> -
A list of files attached to this message.
final
-
The author of this message.
final
- channel → PartialTextChannel
-
The channel this message was sent in.
no setterinherited
- channelId → Snowflake
-
The ID of the Channel the message was sent in.
no setterinherited
-
channelMentions
→ List<
ChannelMention> -
A list of channels specifically mentioned in this message.
final
-
components
→ List<
MessageComponent> ? -
A list of components in this message.
final
- content → String
-
The content of the message.
final
- editedTimestamp → DateTime?
-
The time when this message was last edited, or
null
if the message was never edited.final -
embeds
→ List<
Embed> -
A list of embeds in this message.
final
- flags → MessageFlags
-
Any flags applied to this message.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- id → Snowflake
-
The id of this entity.
finalinherited
- interaction → MessageInteraction?
-
Information about the interaction related to this message.
final
- interactionMetadata → MessageInteractionMetadata?
-
Information about the interaction related to this message.
final
- isPinned → bool
-
Whether this message is pinned.
final
- isTts → bool
-
Whether this was a TTS message.
final
- manager → MessageManager
-
The manager for this entity.
finalinherited
-
mentions
→ List<
User> -
A list of users specifically mentioned in this message.
final
- mentionsEveryone → bool
-
Whether this message mentions everyone.
final
- nonce → dynamic
-
A user-set value to validate a message was sent.
final
- position → int?
-
A generally increasing integer (there may be gaps or duplicates) that represents the approximate position of this message in a thread.
final
-
reactions
→ List<
Reaction> -
A list of reactions to this message.
final
- reference → MessageReference?
-
Data showing the source of a crosspost, channel follow add, pin, or reply message.
final
- referencedMessage → Message?
-
The message associated with reference.
final
- resolved → ResolvedData?
-
Data about entities in this message's auto-populated select menus.
final
-
roleMentionIds
→ List<
Snowflake> -
final
- roleSubscriptionData → RoleSubscriptionData?
-
Data about the role subscription purchase that prompted this message if this is a MessageType.roleSubscriptionPurchase message.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
stickers
→ List<
StickerItem> -
List of sticker attached to message
final
- thread → Thread?
-
The thread that was started from this message if any,
null
otherwise.final - timestamp → DateTime
-
The time when this message was sent.
final
- type → MessageType
-
The type of this message.
final
- webhook → PartialWebhook?
-
The webhook that sent this message if it was sent by a webhook,
null
otherwise.no setter - webhookId → Snowflake?
-
The ID of the webhook that sent this message if it was sent by a webhook,
null
otherwise.final
Methods
-
crosspost(
) → Future< void> -
Crosspost this message to all channels following the channel this message was sent in.
inherited
-
defaultToString(
) → String -
Same as toString, but only called when dart:mirrors is not available.
inherited
-
delete(
) → Future< void> -
Delete this entity.
inherited
-
deleteAllReactions(
) → Future< void> -
Deletes all reactions on this message.
inherited
-
deleteOwnReaction(
ReactionBuilder emoji) → Future< void> -
Deletes reaction the current user has made on this message.
inherited
-
deleteReaction(
ReactionBuilder emoji, {Snowflake? userId}) → Future< void> -
Deletes a reaction by a user, if specified on this message.
Otherwise deletes reactions by
emoji
.inherited -
edit(
MessageUpdateBuilder builder) → Future< Message> -
Update this message.
inherited
-
fetch(
) → Future< Message> -
Fetch this entity from the API.
inherited
-
fetchReactions(
ReactionBuilder emoji, {Snowflake? after, int? limit}) → Future< List< User> > -
Get a list of users that reacted with a given emoji on a message.
inherited
-
get(
) → Future< Message> -
If this entity exists in the manager's cache, return the cached instance. Otherwise, fetch
this entity and return it.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
pin(
{String? auditLogReason}) → Future< void> -
Pin this message.
inherited
-
react(
ReactionBuilder emoji) → Future< void> -
Creates a reaction on this message.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
unpin(
{String? auditLogReason}) → Future< void> -
Unpin this message.
inherited
-
update(
covariant UpdateBuilder< Message> builder) → Future<Message> -
Update this entity using the provided builder and return the updated entity.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited