pub struct Message {
Show 30 fields pub id: MessageId, pub channel_id: ChannelId, pub author: User, pub content: String, pub timestamp: Timestamp, pub edited_timestamp: Option<Timestamp>, pub tts: bool, pub mention_everyone: bool, pub mentions: Vec<User, Global>, pub mention_roles: Vec<RoleId, Global>, pub mention_channels: Vec<ChannelMention, Global>, pub attachments: Vec<Attachment, Global>, pub embeds: Vec<Embed, Global>, pub reactions: Vec<MessageReaction, Global>, pub nonce: Value, pub pinned: bool, pub webhook_id: Option<WebhookId>, pub kind: MessageType, pub activity: Option<MessageActivity>, pub application: Option<MessageApplication>, pub application_id: Option<ApplicationId>, pub message_reference: Option<MessageReference>, pub flags: Option<MessageFlags>, pub referenced_message: Option<Box<Message, Global>>, pub interaction: Option<MessageInteraction>, pub thread: Option<GuildChannel>, pub components: Vec<ActionRow, Global>, pub sticker_items: Vec<StickerItem, Global>, pub guild_id: Option<GuildId>, pub member: Option<PartialMember>,
}
Expand description

A representation of a message over a guild’s text channel, a group, or a private channel.

Discord docs with some extra fields.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§id: MessageId

The unique Id of the message. Can be used to calculate the creation date of the message.

§channel_id: ChannelId

The Id of the Channel that the message was sent to.

§author: User

The user that sent the message.

§content: String

The content of the message.

§timestamp: Timestamp

Initial message creation timestamp, calculated from its Id.

§edited_timestamp: Option<Timestamp>

The timestamp of the last time the message was updated, if it was.

§tts: bool

Indicator of whether the command is to be played back via text-to-speech.

In the client, this is done via the /tts slash command.

§mention_everyone: bool

Indicator of whether the message mentions everyone.

§mentions: Vec<User, Global>

Array of users mentioned in the message.

§mention_roles: Vec<RoleId, Global>

Array of Roles’ Ids mentioned in the message.

§mention_channels: Vec<ChannelMention, Global>

Channels specifically mentioned in this message.

Note: Not all channel mentions in a message will appear in Self::mention_channels. Only textual channels that are visible to everyone in a lurkable guild will ever be included.

A lurkable guild is one that allows users to read public channels in a server without actually joining the server. It also allows users to look at these channels without being logged in to Discord.

Only crossposted messages (via Channel Following) currently include Self::mention_channels at all. If no mentions in the message meet these requirements, this field will not be sent. Refer to Discord’s documentation for more information.

§attachments: Vec<Attachment, Global>

An vector of the files attached to a message.

§embeds: Vec<Embed, Global>

Array of embeds sent with the message.

§reactions: Vec<MessageReaction, Global>

Array of reactions performed on the message.

§nonce: Value

Non-repeating number used for ensuring message order.

§pinned: bool

Indicator of whether the message is pinned.

§webhook_id: Option<WebhookId>

The Id of the webhook that sent this message, if one did.

§kind: MessageType

Indicator of the type of message this is, i.e. whether it is a regular message or a system message.

§activity: Option<MessageActivity>

Sent with Rich Presence-related chat embeds.

§application: Option<MessageApplication>

Sent with Rich Presence-related chat embeds.

§application_id: Option<ApplicationId>

If the message is an Interaction or application-owned webhook, this is the id of the application.

§message_reference: Option<MessageReference>

Reference data sent with crossposted messages.

§flags: Option<MessageFlags>

Bit flags describing extra features of the message.

§referenced_message: Option<Box<Message, Global>>

The message that was replied to using this message.

§interaction: Option<MessageInteraction>

Sent if the message is a response to an Interaction.

§thread: Option<GuildChannel>

The thread that was started from this message, includes thread member object.

§components: Vec<ActionRow, Global>

The components of this message

§sticker_items: Vec<StickerItem, Global>

Array of message sticker item objects.

§guild_id: Option<GuildId>

The Id of the Guild that the message was sent in. This value will only be present if this message was received over the gateway.

§member: Option<PartialMember>

A partial amount of data about the user’s member data, if this message was sent in a guild.

Trait Implementations§

source§

impl AsRef<MessageId> for Message

source§

fn as_ref(&self) -> &MessageId

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl Clone for Message

source§

fn clone(&self) -> Message

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Message

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl<'de> Deserialize<'de> for Message

source§

fn deserialize<__D>( __deserializer: __D ) -> Result<Message, <__D as Deserializer<'de>>::Error>where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl<'a> From<&'a Message> for MessageId

source§

fn from(message: &Message) -> MessageId

Gets the Id of a Message.

source§

impl From<&Message> for MessageReference

source§

fn from(m: &Message) -> MessageReference

Converts to this type from the input type.
source§

impl From<Message> for MessageId

source§

fn from(message: Message) -> MessageId

Gets the Id of a Message.

source§

impl Serialize for Message

source§

fn serialize<__S>( &self, __serializer: __S ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,