Struct CachedMessage

Source
pub struct CachedMessage { /* private fields */ }
Expand description

Represents a cached Message.

Implementations§

Source§

impl CachedMessage

Source

pub const fn activity(&self) -> Option<&MessageActivity>

For rich presence chat embeds, the activity object.

Source

pub const fn application(&self) -> Option<&MessageApplication>

For interaction responses, the ID of the interaction’s application.

Source

pub const fn application_id(&self) -> Option<Id<ApplicationMarker>>

Associated application’s ID.

Sent if the message is a response to an Interaction.

Source

pub fn attachments(&self) -> &[Attachment]

List of attached files.

Refer to the documentation for Message::attachments for caveats with receiving the attachments of messages.

Source

pub const fn author(&self) -> Id<UserMarker>

ID of the message author.

If the author is a webhook, this is its ID.

Source

pub const fn channel_id(&self) -> Id<ChannelMarker>

ID of the channel the message was sent in.

Source

pub fn components(&self) -> &[Component]

List of provided components, such as buttons.

Refer to the documentation for Message::components for caveats with receiving the components of messages.

Source

pub fn content(&self) -> &str

Content of a message.

Refer to the documentation for Message::content for caveats with receiving the content of messages.

Source

pub const fn edited_timestamp(&self) -> Option<Timestamp>

Timestamp of the date the message was last edited.

Source

pub fn embeds(&self) -> &[Embed]

List of embeds.

Refer to the documentation for Message::embeds for caveats with receiving the embeds of messages.

Source

pub const fn flags(&self) -> Option<MessageFlags>

Message flags.

Source

pub const fn guild_id(&self) -> Option<Id<GuildMarker>>

ID of the guild the message was sent in, if there is one.

Source

pub const fn id(&self) -> Id<MessageMarker>

ID of the message.

Source

pub const fn interaction(&self) -> Option<&CachedMessageInteraction>

Information about the message interaction.

Source

pub const fn kind(&self) -> MessageType

Type of the message.

Source

pub const fn member(&self) -> Option<&PartialMember>

Member data for the author, if there is any.

Source

pub fn mention_channels(&self) -> &[ChannelMention]

Channels mentioned in the content.

Source

pub const fn mention_everyone(&self) -> bool

Whether or not ‘@everyone’ or ‘@here’ is mentioned in the content.

Source

pub fn mention_roles(&self) -> &[Id<RoleMarker>]

Roles mentioned in the content.

Source

pub fn mentions(&self) -> &[Id<UserMarker>]

Users mentioned in the content.

Source

pub const fn pinned(&self) -> bool

Whether or not the message is pinned.

Source

pub fn reactions(&self) -> &[Reaction]

Reactions to the message.

Source

pub const fn reference(&self) -> Option<&MessageReference>

Message reference.

Source

pub const fn role_subscription_data(&self) -> Option<&RoleSubscriptionData>

Information about the role subscription purchase or renewal that prompted this message.

Source

pub fn sticker_items(&self) -> &[MessageSticker]

Stickers within the message.

Source

pub const fn thread_id(&self) -> Option<Id<ChannelMarker>>

ID of the thread the message was sent in.

Source

pub const fn timestamp(&self) -> Timestamp

Timestamp of the date the message was sent.

Source

pub const fn tts(&self) -> bool

Whether the message is text-to-speech.

Source

pub const fn webhook_id(&self) -> Option<Id<WebhookMarker>>

For messages sent by webhooks, the webhook ID.

Trait Implementations§

Source§

impl CacheableMessage for CachedMessage

Source§

fn reactions(&self) -> &[Reaction]

Reactions added to this message.
Source§

fn reactions_mut(&mut self) -> &mut [Reaction]

Mutable getter for reactions added to this message.
Source§

fn retain_reactions(&mut self, f: impl FnMut(&Reaction) -> bool)

Retain all reactions to this message matching a predicate, removing non-matching ones.
Source§

fn clear_reactions(&mut self)

Clear all reactions to this message.
Source§

fn add_reaction(&mut self, reaction: Reaction)

Add a reaction to this message.
Source§

fn remove_reaction(&mut self, idx: usize)

Remove a reaction from this message.
Source§

impl Clone for CachedMessage

Source§

fn clone(&self) -> CachedMessage

Returns a duplicate 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 CachedMessage

Source§

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

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

impl From<Message> for CachedMessage

Source§

fn from(message: Message) -> Self

Converts to this type from the input type.
Source§

impl PartialEq<Message> for CachedMessage

Source§

fn eq(&self, other: &Message) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq for CachedMessage

Source§

fn eq(&self, other: &CachedMessage) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for CachedMessage

Source§

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

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for CachedMessage

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where 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 T
where T: Clone,

Source§

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 T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.