#[non_exhaustive]pub struct Embed {Show 13 fields
pub author: Option<EmbedAuthor>,
pub colour: Option<Colour>,
pub description: Option<String>,
pub fields: Vec<EmbedField>,
pub footer: Option<EmbedFooter>,
pub image: Option<EmbedImage>,
pub kind: Option<String>,
pub provider: Option<EmbedProvider>,
pub thumbnail: Option<EmbedThumbnail>,
pub timestamp: Option<String>,
pub title: Option<String>,
pub url: Option<String>,
pub video: Option<EmbedVideo>,
}
Expand description
Represents a rich embed which allows using richer markdown, multiple fields and more. This was heavily inspired by slack’s attachments.
You can include an attachment in your own message by a user or a bot, or in a webhook.
Note: Maximum amount of characters you can put is 256 in a field name, 1024 in a field value, and 2048 in a description.
Fields (Non-exhaustive)
This struct is marked as non-exhaustive
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.Information about the author of the embed.
colour: Option<Colour>
utils
only.The colour code of the embed.
description: Option<String>
The description of the embed.
The maximum value for this field is 2048 unicode codepoints.
fields: Vec<EmbedField>
The array of fields.
The maximum number of fields is 25.
Footer information for the embed.
image: Option<EmbedImage>
Image information of the embed.
kind: Option<String>
The type of the embed. For embeds not generated by Discord’s backend, this will always be “rich”.
provider: Option<EmbedProvider>
Provider information for the embed.
For example, if the embed Self::kind
is "video"
, the provider might
contain information about YouTube.
thumbnail: Option<EmbedThumbnail>
Thumbnail information of the embed.
timestamp: Option<String>
Timestamp information.
title: Option<String>
The title of the embed.
url: Option<String>
The URL of the embed.
video: Option<EmbedVideo>
The embed’s video information.
This is present if the Self::kind
is "video"
.
Implementations
sourceimpl Embed
impl Embed
sourcepub fn fake<F>(f: F) -> Value where
F: FnOnce(&mut CreateEmbed) -> &mut CreateEmbed,
Available on crate feature model
only.
pub fn fake<F>(f: F) -> Value where
F: FnOnce(&mut CreateEmbed) -> &mut CreateEmbed,
model
only.Creates a fake Embed, giving back a serde_json
map.
This should only be useful in conjunction with Webhook::execute
.
Examples
Create an embed:
use serenity::model::channel::Embed;
let embed = Embed::fake(|e| {
e.title("Embed title").description("Making a basic embed").field(
"A field",
"Has some content.",
false,
)
});
Trait Implementations
sourceimpl<'de> Deserialize<'de> for Embed
impl<'de> Deserialize<'de> for Embed
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl From<Embed> for CreateEmbed
impl From<Embed> for CreateEmbed
Auto Trait Implementations
impl RefUnwindSafe for Embed
impl Send for Embed
impl Sync for Embed
impl Unpin for Embed
impl UnwindSafe for Embed
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more