Struct twilight_http::request::channel::message::update_message::UpdateMessage[][src]

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

Update a message by ChannelId and MessageId.

You can pass None to any of the methods to remove the associated field. For example, if you have a message with an embed you want to remove, you can use .embed(None) to remove the embed.

Examples

Replace the content with "test update":

use twilight_http::Client;
use twilight_model::id::{ChannelId, MessageId};

let client = Client::new("my token".to_owned());
client.update_message(ChannelId(1), MessageId(2))
    .content(Some("test update"))?
    .exec()
    .await?;

Remove the message’s content:

client.update_message(ChannelId(1), MessageId(2))
    .content(None)?
    .exec()
    .await?;

Implementations

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.

Calling this method will clear any previous calls.

Add multiple Components to a message.

Calling this method multiple times will clear previous calls.

Pass None to clear existing components.

Errors

Returns an UpdateMessageErrorType::ComponentCount error type if too many components are provided.

Returns an UpdateMessageErrorType::ComponentInvalid error type if one of the provided components is invalid.

Set the content of the message.

Pass None if you want to remove the message content.

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

The maximum length is 2000 UTF-16 characters.

Errors

Returns an UpdateMessageErrorType::ContentInvalid error type if the content length is too long.

Attach multiple embeds to the message.

To keep all embeds, do not use this.

To modify one or more embeds in the message, acquire them from the previous message, mutate them in place, then pass that list to this method.

To remove all embeds pass an empty slice.

Note that if there is no content or file then you will not be able to remove all of the embeds.

Calling this method will clear any previous calls.

Errors

Returns an UpdateMessageErrorType::EmbedTooLarge error type if an embed is too large.

Suppress the embeds in the message.

Set the AllowedMentions in the message.

Execute the request, returning a future resolving to a Response.

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.

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