Struct serenity::model::channel::Embed[][src]

#[non_exhaustive]
pub struct Embed {
Show 13 fields pub author: Option<EmbedAuthor>, pub colour: Colour, pub description: Option<String>, pub fields: Vec<EmbedField>, pub footer: Option<EmbedFooter>, pub image: Option<EmbedImage>, pub kind: 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
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
author: Option<EmbedAuthor>

Information about the author of the embed.

colour: Colour

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: Option<EmbedFooter>

Footer information for the embed.

image: Option<EmbedImage>

Image information of the embed.

kind: 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

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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Deserialize this value from the given Serde deserializer. Read more

Converts the fields of an embed into the values for a new embed builder.

Some values - such as Proxy URLs - are not preserved.

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more