pub struct EmbedBuilder { /* private fields */ }Expand description
A rich embed, built with chained setters and sent with
MessageOptions::embed:
use zaun_client::{EmbedBuilder, MessageOptions, Picture};
let embed = EmbedBuilder::new()
.title("Release 1.2")
.url("https://example.com/releases/1.2")
.description("What changed")
.color(0x5865F2)
.author("Release bot", None, Some(Picture::file("bot.png")))
.field("Fixes", "12", true)
.field("Features", "3", true)
.image(Picture::file("screenshot.png"))
.footer("zaun", None);
channel.send(MessageOptions::new().embed(embed))?;Implementations§
Source§impl EmbedBuilder
impl EmbedBuilder
Sourcepub fn new() -> Self
pub fn new() -> Self
An empty embed. One needs a title, a description, an author, a footer, a picture or a field to be sent.
Sourcepub fn description(self, description: impl Into<String>) -> Self
pub fn description(self, description: impl Into<String>) -> Self
The text (1–4 096 characters).
Sourcepub fn url(self, url: impl Into<String>) -> Self
pub fn url(self, url: impl Into<String>) -> Self
The title’s link: https:// only. A reader opens it by choice; nothing loads it.
The author line: a name (1–256 characters), a link (https://) and a small picture.
The footer line: a text (1–2 048 characters) and a small picture.
Sourcepub fn field(
self,
name: impl Into<String>,
value: impl Into<String>,
inline: bool,
) -> Self
pub fn field( self, name: impl Into<String>, value: impl Into<String>, inline: bool, ) -> Self
Adds a field (name 1–256, value 1–1 024 characters; up to 25), shown beside the
neighbouring inline fields when inline.
Trait Implementations§
Source§impl Clone for EmbedBuilder
impl Clone for EmbedBuilder
Source§fn clone(&self) -> EmbedBuilder
fn clone(&self) -> EmbedBuilder
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for EmbedBuilder
impl Debug for EmbedBuilder
Source§impl Default for EmbedBuilder
impl Default for EmbedBuilder
Source§fn default() -> EmbedBuilder
fn default() -> EmbedBuilder
Returns the “default value” for a type. Read more
impl Eq for EmbedBuilder
Source§impl From<Embed> for EmbedBuilder
impl From<Embed> for EmbedBuilder
Source§fn from(embed: Embed) -> Self
fn from(embed: Embed) -> Self
An embed as received (Message::embeds), to send again or
change: its pictures stay the attachments it names.
Source§impl From<EmbedBuilder> for MessageOptions
impl From<EmbedBuilder> for MessageOptions
Source§fn from(embed: EmbedBuilder) -> Self
fn from(embed: EmbedBuilder) -> Self
Converts to this type from the input type.
Source§impl From<EmbedBuilder> for EditMessage
impl From<EmbedBuilder> for EditMessage
Source§fn from(embed: EmbedBuilder) -> Self
fn from(embed: EmbedBuilder) -> Self
Converts to this type from the input type.
Source§impl PartialEq for EmbedBuilder
impl PartialEq for EmbedBuilder
impl StructuralPartialEq for EmbedBuilder
Auto Trait Implementations§
impl Freeze for EmbedBuilder
impl RefUnwindSafe for EmbedBuilder
impl Send for EmbedBuilder
impl Sync for EmbedBuilder
impl Unpin for EmbedBuilder
impl UnsafeUnpin for EmbedBuilder
impl UnwindSafe for EmbedBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CryptoSafe for T
impl<T> CryptoSafe for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more