Struct MessageOptions
zaun_client::MessageOptions · Struct
pub struct MessageOptions { … }A message to post: text, embeds, files and the message it answers. A plain &str is one
with text only, so channel.send("hi") still reads as it did.
use zaun_client::{EmbedBuilder, MessageOptions, Picture};
channel.send( MessageOptions::new() .content("Today's weather") .embed(EmbedBuilder::new().title("Sunny").image(Picture::file("map.png"))) .file("forecast.pdf"),)?;Methods
Section titled “Methods”mention_member
Section titled “mention_member”pub fn mention_member(self, member: MemberId) -> SelfNotifies member (write mention::member in the text to show where). Each member
counts once; at most 50.
mention_role
Section titled “mention_role”pub fn mention_role(self, role: RoleId) -> SelfNotifies the members with role (mention::role shows it). The host drops a role
that is not mentionable unless this member has MENTION_EVERYONE. At most 20.
mention_everyone
Section titled “mention_everyone”pub fn mention_everyone(self) -> SelfNotifies everyone who can see the channel (needs MENTION_EVERYONE; dropped without).
mentions
Section titled “mentions”pub fn mentions(self, mentions: Mentions) -> SelfNotifies exactly mentions.
mentions_from_content
Section titled “mentions_from_content”pub fn mentions_from_content(self) -> SelfAlso notifies whoever the text shows (<@id>, <@&id>, @everyone; see
mention::parse). Call it after content, and only for text
this member wrote.
pub fn new() -> SelfAn empty message; it needs text, an embed or a file.
content
Section titled “content”pub fn content<impl Into<String>>(self, content: impl Into<String>) -> SelfThe text (up to 4 000 characters; may be empty beside an embed or a file).
pub fn embed<impl Into<EmbedBuilder>>(self, embed: impl Into<EmbedBuilder>) -> SelfAdds an embed (up to 10). Its pictures are uploaded with the message’s files.
embeds
Section titled “embeds”pub fn embeds<impl Into<EmbedBuilder>, impl IntoIterator<Item = impl Into<EmbedBuilder>>>(self, embeds: impl IntoIterator<Item = impl Into<EmbedBuilder>>) -> SelfAdds embeds.
pub fn file<impl Into<PathBuf>>(self, path: impl Into<PathBuf>) -> SelfAttaches the file at path (with the embeds’ pictures, up to 10 files in all). A file
that is also an embed’s picture is uploaded once.
file_bytes
Section titled “file_bytes”pub fn file_bytes<impl Into<String>, impl Into<Vec<u8>>>(self, name: impl Into<String>, data: impl Into<Vec<u8>>) -> SelfAttaches data as a file named name.
reply_to
Section titled “reply_to”pub const fn reply_to(self, message: MessageId) -> SelfPosts it as an answer to message.
Trait implementations
Section titled “Trait implementations”Clone, Debug, Default, Eq, From<&String>, From<&str>, From<EmbedBuilder>, From<String>, PartialEq, StructuralPartialEq