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.
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.
pub fn exec(self) -> ResponseFuture<Message>ⓘNotable traits for ResponseFuture<T>impl<T: Unpin> Future for ResponseFuture<T> type Output = Result<Response<T>, Error>;
pub fn exec(self) -> ResponseFuture<Message>ⓘNotable traits for ResponseFuture<T>impl<T: Unpin> Future for ResponseFuture<T> type Output = Result<Response<T>, Error>;
impl<T: Unpin> Future for ResponseFuture<T> type Output = Result<Response<T>, Error>;
Execute the request, returning a future resolving to a Response
.