pub struct MessageOptions { /* private fields */ }Expand description
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"),
)?;Implementations§
Source§impl MessageOptions
impl MessageOptions
Sourcepub fn mention_member(self, member: MemberId) -> Self
pub fn mention_member(self, member: MemberId) -> Self
Notifies member (write mention::member in the text to show where). Each member
counts once; at most 50.
Sourcepub fn mention_role(self, role: RoleId) -> Self
pub fn mention_role(self, role: RoleId) -> Self
Notifies 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.
Sourcepub fn mention_everyone(self) -> Self
pub fn mention_everyone(self) -> Self
Notifies everyone who can see the channel (needs MENTION_EVERYONE; dropped without).
Sourcepub fn mentions_from_content(self) -> Self
pub fn mentions_from_content(self) -> Self
Also notifies whoever the text shows (<@id>, <@&id>, @everyone; see
mention::parse). Call it after content, and only for text
this member wrote.
Source§impl MessageOptions
impl MessageOptions
Sourcepub fn content(self, content: impl Into<String>) -> Self
pub fn content(self, content: impl Into<String>) -> Self
The text (up to 4 000 characters; may be empty beside an embed or a file).
Sourcepub fn embed(self, embed: impl Into<EmbedBuilder>) -> Self
pub fn embed(self, embed: impl Into<EmbedBuilder>) -> Self
Adds an embed (up to 10). Its pictures are uploaded with the message’s files.
Sourcepub fn embeds(
self,
embeds: impl IntoIterator<Item = impl Into<EmbedBuilder>>,
) -> Self
pub fn embeds( self, embeds: impl IntoIterator<Item = impl Into<EmbedBuilder>>, ) -> Self
Adds embeds.
Sourcepub fn file(self, path: impl Into<PathBuf>) -> Self
pub fn file(self, path: impl Into<PathBuf>) -> Self
Attaches 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.
Trait Implementations§
Source§impl Clone for MessageOptions
impl Clone for MessageOptions
Source§fn clone(&self) -> MessageOptions
fn clone(&self) -> MessageOptions
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more