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

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

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");
client.update_message(ChannelId(1), MessageId(2))
    .content("test update".to_owned())?
    .await?;

Remove the message's content:

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

Implementations

impl<'a> UpdateMessage<'a>[src]

pub fn content(
    self,
    content: impl Into<Option<String>>
) -> Result<Self, UpdateMessageError>
[src]

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 UpdateMessageError::ContentInvalid if the content length is too long.

pub fn embed(
    self,
    embed: impl Into<Option<Embed>>
) -> Result<Self, UpdateMessageError>
[src]

Set the embed of the message.

Pass None if you want to remove the message embed.

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

pub fn suppress_embeds(mut self: Self, suppress: bool) -> Self[src]

Suppress the embeds in the message.

pub fn allowed_mentions(mut self: Self, allowed: AllowedMentions) -> Self[src]

Set the allowed mentions in the message.

Use the build_solo method to get a AllowedMentions structure.

Trait Implementations

impl Future for UpdateMessage<'_>[src]

type Output = Result<Message>

The type of value produced on completion.

Auto Trait Implementations

impl<'a> !RefUnwindSafe for UpdateMessage<'a>[src]

impl<'a> Send for UpdateMessage<'a>[src]

impl<'a> !Sync for UpdateMessage<'a>[src]

impl<'a> Unpin for UpdateMessage<'a>[src]

impl<'a> !UnwindSafe for UpdateMessage<'a>[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> FutureExt for T where
    T: Future + ?Sized
[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<F> IntoFuture for F where
    F: Future
[src]

type Output = <F as Future>::Output

🔬 This is a nightly-only experimental API. (into_future)

The output that the future will produce on completion.

type Future = F

🔬 This is a nightly-only experimental API. (into_future)

Which kind of future are we turning this into?

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<F, T, E> TryFuture for F where
    F: Future<Output = Result<T, E>> + ?Sized

type Ok = T

The type of successful values yielded by this future

type Error = E

The type of failures yielded by this future

impl<Fut> TryFutureExt for Fut where
    Fut: TryFuture + ?Sized
[src]

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,