Struct twilight_http::request::application::UpdateOriginalResponse[][src]

pub struct UpdateOriginalResponse<'a> { /* fields omitted */ }
Expand description

Update the original response created by a interaction.

A response must always have at least one embed or some amount of content. If you wish to delete a original response refer to DeleteOriginalResponse.

Examples

Update the original response 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 std::env;
use twilight_http::Client;
use twilight_model::{
    channel::message::AllowedMentions,
    id::ApplicationId,
};

let client = Client::new(env::var("DISCORD_TOKEN")?);
client.set_application_id(ApplicationId(1));

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

Implementations

Maximum number of embeds that a original response may have.

Set the allowed mentions in the message.

Specify multiple attachments already present in the target message to keep.

If called, all unspecified attachments will be removed from the message. If not called, all attachments will be kept.

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 an UpdateOriginalResponseErrorType::ContentInvalid error type if the content length is too long.

Set the list of embeds of the original response.

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 std::env;
use twilight_http::Client;
use twilight_embed_builder::EmbedBuilder;
use twilight_model::id::ApplicationId;

let client = Client::new(env::var("DISCORD_TOKEN")?);
client.set_application_id(ApplicationId(1));

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_interaction_original("token")?
    .embeds(Some(&[embed]))?
    .exec()
    .await?;

Errors

Returns an UpdateOriginalResponseErrorType::EmbedTooLarge error type if one of the embeds are too large.

Returns an UpdateOriginalResponseErrorType::TooManyEmbeds error type if more than 10 embeds are provided.

Attach multiple files to the original response.

JSON encoded body of any additional request fields.

If this method is called, all other fields are ignored, except for files. See Discord Docs/Create Message and CreateFollowupMessage::payload_json.

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

Performs the conversion.

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.