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

Update a message by Id<ChannelMarker> and Id<MessageMarker>.

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::Id;

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

Remove the message’s content:

client.update_message(Id::new(1), Id::new(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

Refer to the errors section of twilight_validate::component::component for a list of errors that may be returned as a result of validating each provided component.

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 error of type ContentInvalid 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 error of type TooManyEmbeds if there are too many embeds.

Otherwise, refer to the errors section of embed for a list of errors that may occur.

Suppress the embeds in the message.

Set the AllowedMentions in the message.

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

Trait Implementations

Try to convert a request builder into a raw Request. 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

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