pub struct Message { /* private fields */ }Expand description
A message in a channel.
Implementations§
Source§impl Message
impl Message
Sourcepub fn components(&self) -> &[Component]
pub fn components(&self) -> &[Component]
Its buttons, selects and layout (bots only).
Sourcepub const fn is_loading(&self) -> bool
pub const fn is_loading(&self) -> bool
Whether a deferred bot reply is still “thinking…”.
Sourcepub const fn interaction(&self) -> Option<&InteractionMetadata>
pub const fn interaction(&self) -> Option<&InteractionMetadata>
The interaction this bot reply answers.
Source§impl Message
impl Message
Sourcepub const fn mentions(&self) -> &Mentions
pub const fn mentions(&self) -> &Mentions
Who it mentions, as the host honoured them: everyone, members, roles. For a
message this client just posted, the ones it asked for.
Sourcepub fn mentions_member(&self, member: &Member) -> bool
pub fn mentions_member(&self, member: &Member) -> bool
Whether it mentions member: by id, by one of the member’s roles (as the cache has
them), or by @everyone.
Sourcepub fn mentions_me(&self) -> bool
pub fn mentions_me(&self) -> bool
Whether it mentions this client’s member (a client notifies its member then, unless
the message is silent).
Source§impl Message
impl Message
Sourcepub fn embeds(&self) -> &[Embed]
pub fn embeds(&self) -> &[Embed]
Its rich embeds. A picture names one of attachments
(attachment finds it); nothing is fetched from elsewhere.
Who wrote it.
Sourcepub fn attachments(&self) -> Vec<Attachment>
pub fn attachments(&self) -> Vec<Attachment>
Its files; Attachment::download fetches one.
Sourcepub fn attachment(&self, id: AttachmentId) -> Option<Attachment>
pub fn attachment(&self, id: AttachmentId) -> Option<Attachment>
One of its attachments, by id: an embed’s picture, say.
Sourcepub fn reply(&self, options: impl Into<MessageOptions>) -> Result<Self>
pub fn reply(&self, options: impl Into<MessageOptions>) -> Result<Self>
Sourcepub fn edit(&mut self, options: impl Into<EditMessage>) -> Result<()>
pub fn edit(&mut self, options: impl Into<EditMessage>) -> Result<()>
Edits this message (one of this member’s): new text (message.edit("…")), or an
EditMessage that also replaces or removes the embeds or the mentions. Text not
given stays, and so do the mentions unless the edit names some (then they replace
them all). Pictures of new embeds must be attachments the message already has.
§Errors
A picture still to upload or a broken embed (Error::Protocol), embeds to a host
that does not keep them (Error::Unsupported), or the host refused or did not
answer.
Sourcepub fn delete(&self) -> Result<()>
pub fn delete(&self) -> Result<()>
Deletes this message (one’s own, or any with MANAGE_MESSAGES).
§Errors
The host refused or did not answer.