pub struct CreateEmbed(/* private fields */);
Expand description
A builder to create an embed in a message
Implementations§
Source§impl CreateEmbed
impl CreateEmbed
Sourcepub fn new() -> Self
pub fn new() -> Self
Equivalent to Self::default
.
Set the author of the embed.
Refer to the documentation for CreateEmbedAuthor
for more information.
Sourcepub fn color<C: Into<Colour>>(self, colour: C) -> Self
pub fn color<C: Into<Colour>>(self, colour: C) -> Self
Set the colour of the left-hand side of the embed.
This is an alias of Self::colour
.
Sourcepub fn colour<C: Into<Colour>>(self, colour: C) -> Self
pub fn colour<C: Into<Colour>>(self, colour: C) -> Self
Set the colour of the left-hand side of the embed.
Sourcepub fn description(self, description: impl Into<String>) -> Self
pub fn description(self, description: impl Into<String>) -> Self
Set the description of the embed.
Note: This can’t be longer than 4096 characters.
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
Set a field. Note that this will not overwrite other fields, and will add to them.
Note: Maximum amount of characters you can put is 256 in a field name and 1024 in a field value.
Sourcepub fn fields<N, V>(
self,
fields: impl IntoIterator<Item = (N, V, bool)>,
) -> Self
pub fn fields<N, V>( self, fields: impl IntoIterator<Item = (N, V, bool)>, ) -> Self
Adds multiple fields at once.
This is sugar to reduce the need of calling Self::field
manually multiple times.
Set the footer of the embed.
Refer to the documentation for CreateEmbedFooter
for more information.
Sourcepub fn image(self, url: impl Into<String>) -> Self
pub fn image(self, url: impl Into<String>) -> Self
Set the image associated with the embed.
Refer Discord Documentation for rules on naming local attachments.
Sourcepub fn url(self, url: impl Into<String>) -> Self
pub fn url(self, url: impl Into<String>) -> Self
Set the URL to direct to when clicking on the title.
Sourcepub fn attachment(self, filename: impl Into<String>) -> Self
pub fn attachment(self, filename: impl Into<String>) -> Self
Same as calling Self::image
with “attachment://filename.(jpg, png)”.
Note however, you have to be sure you set an attachment (with ChannelId::send_files
)
with the provided filename. Or else this won’t work.
Refer Self::image
for rules on naming local attachments.
Trait Implementations§
Source§impl Clone for CreateEmbed
impl Clone for CreateEmbed
Source§fn clone(&self) -> CreateEmbed
fn clone(&self) -> CreateEmbed
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more