Struct twilight_http::request::channel::message::update_message::UpdateMessage
source · [−]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.
pub fn components(
self,
components: Option<&'a [Component]>
) -> Result<Self, MessageValidationError>
pub fn components(
self,
components: Option<&'a [Component]>
) -> Result<Self, MessageValidationError>
Add multiple Component
s 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.
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
.
Trait Implementations
Auto Trait Implementations
impl<'a> !RefUnwindSafe for UpdateMessage<'a>
impl<'a> Send for UpdateMessage<'a>
impl<'a> Sync for UpdateMessage<'a>
impl<'a> Unpin for UpdateMessage<'a>
impl<'a> !UnwindSafe for UpdateMessage<'a>
Blanket Implementations
Mutably borrows from an owned value. Read more
pub fn vzip(self) -> V
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