[−][src]Struct twilight_builders::embed::EmbedBuilder
Create an embed via a builder.
If uploading an image as an attachment, set as the image or thumbnail with
attachment://{filename}.{extension}
. Refer to the discord docs for more information.
Examples
A simple embed:
use twilight_builders::embed::EmbedBuilder; let embed = EmbedBuilder::new() .description("Here's a list of reasons why Twilight is the best pony:") .add_field("Wings", "She has wings.") .inline() .commit() .add_field("Horn", "She can do magic, and she's really good at it.") .commit() .build();
An embed with images:
use twilight_builders::embed::EmbedBuilder; let embed = EmbedBuilder::new() .description("Here's a cool image of Twilight Sparkle") .image("attachment://bestpony.png") .build();
Implementations
impl EmbedBuilder
[src]
pub fn new() -> Self
[src]
pub fn author(self) -> AuthorBuilder
[src]
Return a new AuthorBuilder
.
pub fn color(self, color: u32) -> Self
[src]
Set the color.
Use hexadecimal syntax to specify an integer: 0xD4A4E8
pub fn description(self, description: impl Into<String>) -> Self
[src]
Set the description.
Limited to 2048 UTF-16 code points.
pub fn add_field(
self,
name: impl Into<String>,
value: impl Into<String>
) -> FieldBuilder
[src]
self,
name: impl Into<String>,
value: impl Into<String>
) -> FieldBuilder
Add a field with a new FieldBuilder
.
The name is limited to 256 UTF-16 code points, and the value is limited to 1024. The amount of fields is limited to 25.
pub fn footer(self, text: impl Into<String>) -> FooterBuilder
[src]
Return a new FooterBuilder
.
The text is limited to 2048 UTF-16 code points.
pub fn image(self, url: impl Into<String>) -> Self
[src]
Add an image.
Either the URL to an image or an attachment://
path.
pub fn thumbnail(self, url: impl Into<String>) -> Self
[src]
Add a thumbnail.
Either the URL to an image or an attachment://
path.
pub fn timestamp(self, timestamp: impl Into<String>) -> Self
[src]
Set the ISO 8601 timestamp.
pub fn title(self, title: impl Into<String>) -> Self
[src]
Set the title.
Limited to 256 UTF-16 code points.
pub fn url(self, url: impl Into<String>) -> Self
[src]
Set the URL.
pub fn build(self) -> Embed
[src]
Return an Embed
.
Trait Implementations
impl Clone for EmbedBuilder
[src]
fn clone(&self) -> EmbedBuilder
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for EmbedBuilder
[src]
impl Default for EmbedBuilder
[src]
Auto Trait Implementations
impl RefUnwindSafe for EmbedBuilder
impl Send for EmbedBuilder
impl Sync for EmbedBuilder
impl Unpin for EmbedBuilder
impl UnwindSafe for EmbedBuilder
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,