pub fn embeds(mut self, embeds: Option<Vec<Embed>>) -> Result<Self, UpdateWebhookMessageError> {
        if let Some(embeds_present) = embeds.as_deref() {
            if embeds_present.len() > Self::EMBED_COUNT_LIMIT {
                return Err(UpdateWebhookMessageError::TooManyEmbeds {
                    embeds: embeds.expect("embeds are known to be present"),
                });
            }

            for (idx, embed) in embeds_present.iter().enumerate() {
                if let Err(source) = validate::embed(&embed) {
                    return Err(UpdateWebhookMessageError::EmbedTooLarge {
                        embeds: embeds.expect("embeds are known to be present"),
                        index: idx,
                        source,
                    });
                }
            }
        }

        self.fields.embeds.replace(embeds);

        Ok(self)
    }
/// Set the list of embeds of the webhook's message.
///
/// Pass `None` to remove all of the embeds.
///
/// The maximum number of allowed embeds is defined by
/// [`EMBED_COUNT_LIMIT`].
///
/// The total character length of each embed must not exceed 6000
/// characters. Additionally, the internal fields also have character
/// limits. Refer to [the discord docs] for more information.
///
/// # Examples
///
/// Create an embed and update the message with the new embed. The content
/// of the original message is unaffected and only the embed(s) are
/// modified.
///
/// ```no_run
/// # use twilight_http::Client;
/// use twilight_embed_builder::EmbedBuilder;
/// use twilight_model::id::{MessageId, WebhookId};
///
/// # #[tokio::main] async fn main() -> Result<(), Box<dyn std::error::Error>> {
/// # let client = Client::new("token");
/// let embed = EmbedBuilder::new()
///     .description("Powerful, flexible, and scalable ecosystem of Rust libraries for the Discord API.")?
///     .title("Twilight")?
///     .url("https://twilight.rs")
///     .build()?;
///
/// client.update_webhook_message(WebhookId(1), "token", MessageId(2))
///     .embeds(Some(vec![embed]))?
///     .await?;
/// # Ok(()) }
/// ```
///
/// # Errors
///
/// Returns [`UpdateWebhookMessageError::EmbedTooLarge`] if one of the
/// embeds are too large.
///
/// Returns [`UpdateWebhookMessageError::TooManyEmbeds`] if more than 10
/// embeds are provided.
///
/// [the discord docs]: https://discord.com/developers/docs/resources/channel#embed-limits
/// [`EMBED_COUNT_LIMIT`]: Self::EMBED_COUNT_LIMIT
Set the list of embeds of the webhook's message.
Pass `None` to remove all of the embeds.

The maximum number of allowed embeds is defined by
[`EMBED_COUNT_LIMIT`].

The total character length of each embed must not exceed 6000
characters. Additionally, the internal fields also have character
limits. Refer to [the discord docs] for more information.
Set the list of embeds of the webhook ' s message . Pass ` None ` to remove all of the embeds . The maximum number of allowed embeds is defined by [ ` EMBED_COUNT_LIMIT ` ] . The total character length of each embed must not exceed 6000 characters . Additionally the internal fields also have character limits . Refer to [ the discord docs ] for more information .
pub fn embeds(mut self, embeds: Option<Vec<Embed>>) -> Result<Self, UpdateWebhookMessageError> {
        if let Some(embeds_present) = embeds.as_deref() {
            if embeds_present.len() > Self::EMBED_COUNT_LIMIT {
                return Err(UpdateWebhookMessageError::TooManyEmbeds {
                    embeds: embeds.expect("embeds are known to be present"),
                });
            }
            for (idx, embed) in embeds_present.iter().enumerate() {
                if let Err(source) = validate::embed(&embed) {
                    return Err(UpdateWebhookMessageError::EmbedTooLarge {
                        embeds: embeds.expect("embeds are known to be present"),
                        index: idx,
                        source,
                    });
                }
            }
        }
        self.fields.embeds.replace(embeds);
        Ok(self)
    }
pub fn embeds ( mut self , embeds : Option < Vec < Embed > > ) -> Result < Self , UpdateWebhookMessageError > { if let Some ( embeds_present ) = embeds . as_deref ( ) { if embeds_present . len ( ) > Self :: EMBED_COUNT_LIMIT { return Err ( UpdateWebhookMessageError :: TooManyEmbeds { embeds : embeds . expect ( " " ) , } ) ; } for ( idx , embed ) in embeds_present . iter ( ) . enumerate ( ) { if let Err ( source ) = validate :: embed ( & embed ) { return Err ( UpdateWebhookMessageError :: EmbedTooLarge { embeds : embeds . expect ( " " ) , index : idx , source , } ) ; } } } self . fields . embeds . replace ( embeds ) ; Ok ( self ) }
Set the list of embeds of the webhook's message.
Set the list of embeds of the webhook ' s message .
mut self
embeds
Option<Vec<Embed>>
examples
Create an embed and update the message with the new embed. The content
of the original message is unaffected and only the embed(s) are
modified.


Create an embed and update the message with the new embed . The content of the original message is unaffected and only the embed ( s ) are modified .
use twilight_http::client;
use twilight_embed_builder::EmbedBuilder;
use twilight_model::id::{MessageId, WebhookId}.
use twilight_embed_builder :: EmbedBuilder ; use twilight_model :: id :: { MessageId WebhookId } .
#[tokio::main] async fn main() -> result<(), box<dyn std::error::error>> {
None
let client = client::new("token");
let embed = EmbedBuilder::new()
.description("Powerful, flexible, and scalable ecosystem of Rust libraries for the Discord API.").
.title("Twilight").

client.update_webhook_message(WebhookId(1), "token", MessageId(2))
.embeds(Some(vec![embed])).
let embed = EmbedBuilder :: new () . description ( " Powerful flexible and scalable ecosystem of Rust libraries for the Discord API . " ) . . title ( " Twilight " ) . client . update_webhook_message ( WebhookId ( 1 ) " token " MessageId ( 2 )) . embeds ( Some ( vec! [ embed ] )) .
ok(()) }
None
errors
Returns [`UpdateWebhookMessageError::EmbedTooLarge`] if one of the
embeds are too large.

Returns [`UpdateWebhookMessageError::TooManyEmbeds`] if more than 10
embeds are provided.


Returns [ ` UpdateWebhookMessageError :: EmbedTooLarge ` ] if one of the embeds are too large . Returns [ ` UpdateWebhookMessageError :: TooManyEmbeds ` ] if more than 10 embeds are provided .