Struct Message
zaun_client::Message · Struct
pub struct Message { … }A message in a channel.
Methods
Section titled “Methods”components
Section titled “components”pub fn components(&self) -> &[Component]Its buttons, selects and layout (bots only).
pub const fn flags(&self) -> u32Its flags (flags::*).
is_loading
Section titled “is_loading”pub const fn is_loading(&self) -> boolWhether a deferred bot reply is still “thinking…”.
interaction
Section titled “interaction”pub const fn interaction(&self) -> Option<&InteractionMetadata>The interaction this bot reply answers.
pub fn click(&self, custom_id: &str, values: Vec<String>) -> Result<InteractionId>Clicks a button, or chooses values in a select, of this message.
Errors
Section titled “Errors”The host refused (no such enabled component, values out of bounds).
mentions
Section titled “mentions”pub const fn mentions(&self) -> &MentionsWho it mentions, as the host honoured them: everyone, members, roles. For a
message this client just posted, the ones it asked for.
mentions_member
Section titled “mentions_member”pub fn mentions_member(&self, member: &Member) -> boolWhether it mentions member: by id, by one of the member’s roles (as the cache has
them), or by @everyone.
mentions_me
Section titled “mentions_me”pub fn mentions_me(&self) -> boolWhether it mentions this client’s member (a client notifies its member then, unless
the message is silent).
silent
Section titled “silent”pub const fn silent(&self) -> boolSent with SUPPRESS_NOTIFICATIONS: its mentions notify nobody.
pub const fn id(&self) -> MessageIdIts id.
content
Section titled “content”pub fn content(&self) -> &strIts text (empty when it has embeds or attachments instead).
embeds
Section titled “embeds”pub fn embeds(&self) -> &[Embed]Its rich embeds. A picture names one of attachments
(attachment finds it); nothing is fetched from elsewhere.
channel
Section titled “channel”pub const fn channel(&self) -> &ChannelThe channel it is in.
community
Section titled “community”pub const fn community(&self) -> &CommunityThe community it belongs to.
author
Section titled “author”pub fn author(&self) -> MemberWho wrote it.
is_mine
Section titled “is_mine”pub fn is_mine(&self) -> boolWhether this client wrote it.
sequence
Section titled “sequence”pub const fn sequence(&self) -> u64Its position in the channel.
timestamp
Section titled “timestamp”pub const fn timestamp(&self) -> u64When the host accepted it, ms since the epoch.
reply_to
Section titled “reply_to”pub const fn reply_to(&self) -> Option<MessageId>The message it answers.
attachments
Section titled “attachments”pub fn attachments(&self) -> Vec<Attachment>Its files; Attachment::download fetches one.
attachment
Section titled “attachment”pub fn attachment(&self, id: AttachmentId) -> Option<Attachment>One of its attachments, by id: an embed’s picture, say.
pub fn reply<impl Into<MessageOptions>>(&self, options: impl Into<MessageOptions>) -> Result<Self>Answers this message in its channel: text, or MessageOptions.
Errors
Section titled “Errors”As Channel::send.
pub fn edit<impl Into<EditMessage>>(&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
Section titled “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.
delete
Section titled “delete”pub fn delete(&self) -> Result<()>Deletes this message (one’s own, or any with MANAGE_MESSAGES).
Errors
Section titled “Errors”The host refused or did not answer.
pub fn react(&self, emoji: &str) -> Result<()>Adds emoji as this member.
Errors
Section titled “Errors”The host refused or did not answer.
unreact
Section titled “unreact”pub fn unreact(&self, emoji: &str) -> Result<()>Takes this member’s emoji off.
Errors
Section titled “Errors”The host refused or did not answer.
Trait implementations
Section titled “Trait implementations”Clone, Debug, Display, From<&Message>, PartialEq