[][src]Struct twilight_http::request::channel::webhook::update_webhook_message::UpdateWebhookMessage

pub struct UpdateWebhookMessage<'a> { /* fields omitted */ }

Update a message created by a webhook.

A webhook's message must always have at least one embed or some amount of content. If you wish to delete a webhook's message refer to DeleteWebhookMessage.

Examples

Update a webhook's message by setting the content to "test @3" - attempting to mention user ID 3 - and specifying that only that the user may not be mentioned.

use twilight_http::request::channel::allowed_mentions::AllowedMentions;
use twilight_model::id::{MessageId, WebhookId};

client.update_webhook_message(WebhookId(1), "token here", MessageId(2))
    // By creating a default set of allowed mentions, no entity can be
    // mentioned.
    .allowed_mentions(AllowedMentions::default())
    .content(Some("test <@3>".to_owned()))?
    .await?;

Implementations

impl<'a> UpdateWebhookMessage<'a>[src]

pub const EMBED_COUNT_LIMIT: usize[src]

Maximum number of embeds that a webhook's message may have.

pub fn allowed_mentions(self, allowed: AllowedMentions) -> Self[src]

Set the allowed mentions in the message.

pub fn content(
    self,
    content: Option<String>
) -> Result<Self, UpdateWebhookMessageError>
[src]

Set the content of the message.

Pass None if you want to remove the message content.

Note that if there is are no embeds then you will not be able to remove the content of the message.

The maximum length is 2000 UTF-16 characters.

Errors

Returns UpdateWebhookMessageError::ContentInvalid if the content length is too long.

pub fn embeds(
    self,
    embeds: Option<Vec<Embed>>
) -> Result<Self, UpdateWebhookMessageError>
[src]

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.

use twilight_embed_builder::EmbedBuilder;
use twilight_model::id::{MessageId, WebhookId};

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?;

Errors

Returns UpdateWebhookMessageError::EmbedTooLarge if one of the embeds are too large.

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

Trait Implementations

impl<'a> AuditLogReason for UpdateWebhookMessage<'a>[src]

impl Future for UpdateWebhookMessage<'_>[src]

type Output = Result<()>

The type of value produced on completion.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> FutureExt for T where
    T: Future + ?Sized
[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<F> IntoFuture for F where
    F: Future
[src]

type Output = <F as Future>::Output

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

The output that the future will produce on completion.

type Future = F

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

Which kind of future are we turning this into?

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<F, T, E> TryFuture for F where
    F: Future<Output = Result<T, E>> + ?Sized
[src]

type Ok = T

The type of successful values yielded by this future

type Error = E

The type of failures yielded by this future

impl<Fut> TryFutureExt for Fut where
    Fut: TryFuture + ?Sized
[src]

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,