Struct twilight_http::request::application::interaction::update_followup_message::UpdateFollowupMessage [−][src]
pub struct UpdateFollowupMessage<'a> { /* fields omitted */ }
Expand description
Update a followup message.
A followup message must always have at least one embed or some amount of
content. If you wish to delete a followup message refer to
DeleteFollowupMessage
.
Examples
Update a followup message by setting the content to test <@3>
-
attempting to mention user ID 3 - and specifying that only that the user may
not be mentioned.
use std::env;
use twilight_http::Client;
use twilight_model::{
channel::message::AllowedMentions,
id::{MessageId, ApplicationId}
};
let client = Client::new(env::var("DISCORD_TOKEN")?);
client.set_application_id(ApplicationId(1));
client.update_followup_message("token here", MessageId(2))?
// By creating a default set of allowed mentions, no entity can be
// mentioned.
.allowed_mentions(AllowedMentions::default())
.content(Some("test <@3>"))?
.exec()
.await?;
Implementations
Maximum number of embeds that a followup message may have.
Set the allowed mentions in the message.
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.
pub fn components(
self,
components: Option<&'a [Component]>
) -> Result<Self, UpdateFollowupMessageError>
pub fn components(
self,
components: Option<&'a [Component]>
) -> Result<Self, UpdateFollowupMessageError>
Add multiple Component
s to a message.
Calling this method multiple times will clear previous calls.
Pass None
to clear existing components.
Errors
Returns an UpdateFollowupMessageErrorType::ComponentCount
error type
if too many components are provided.
Returns an UpdateFollowupMessageErrorType::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 are no embeds then you will not be able to remove the content of the message.
The maximum length is 2000 UTF-16 characters.
Errors
Returns an UpdateFollowupMessageErrorType::ContentInvalid
error type if
the content length is too long.
Set the list of embeds of the followup message.
Pass None
to remove all of the embeds.
The maximum number of allowed embeds is defined by
EMBED_COUNT_LIMIT
.
The total character length of each embed must not exceed 6000 characters. Additionally, the internal fields also have character limits. Refer to the discord docs for more information.
Examples
Create an embed and update the message with the new embed. The content of the original message is unaffected and only the embed(s) are modified.
use std::env;
use twilight_http::Client;
use twilight_embed_builder::EmbedBuilder;
use twilight_model::id::{ApplicationId, MessageId};
let client = Client::new(env::var("DISCORD_TOKEN")?);
client.set_application_id(ApplicationId(1));
let embed = EmbedBuilder::new()
.description("Powerful, flexible, and scalable ecosystem of Rust libraries for the Discord API.")
.title("Twilight")
.url("https://twilight.rs")
.build()?;
client.update_followup_message("token", MessageId(2))?
.embeds(Some(&[embed]))?
.exec()
.await?;
Errors
Returns an UpdateFollowupMessageErrorType::EmbedTooLarge
error type
if one of the embeds are too large.
Returns an UpdateFollowupMessageErrorType::TooManyEmbeds
error type
if more than 10 embeds are provided.
Attach multiple files to the followup message.
JSON encoded body of any additional request fields.
If this method is called, all other fields are ignored, except for
files
. See Discord Docs/Create Message and
CreateFollowupMessage::payload_json
.
pub fn exec(self) -> ResponseFuture<EmptyBody>ⓘ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>;
Auto Trait Implementations
impl<'a> !RefUnwindSafe for UpdateFollowupMessage<'a>
impl<'a> Send for UpdateFollowupMessage<'a>
impl<'a> Sync for UpdateFollowupMessage<'a>
impl<'a> Unpin for UpdateFollowupMessage<'a>
impl<'a> !UnwindSafe for UpdateFollowupMessage<'a>
Blanket Implementations
Mutably borrows from an owned value. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. 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