Struct twilight_http::request::application::interaction::create_followup_message::CreateFollowupMessage [−][src]
pub struct CreateFollowupMessage<'a> { /* fields omitted */ }Expand description
Create a followup message to an interaction.
You must specify at least one of content, embeds, or files.
Examples
use std::env;
use twilight_http::Client;
use twilight_model::id::ApplicationId;
let client = Client::new(env::var("DISCORD_TOKEN")?);
client.set_application_id(ApplicationId::new(1).expect("non zero"));
client
.create_followup_message("webhook token")?
.content("Pinkie...")
.exec()
.await?;Implementations
Specify the AllowedMentions for the webhook message.
The URL of the avatar of the webhook.
pub fn components(
self,
components: &'a [Component]
) -> Result<Self, CreateFollowupMessageError>
pub fn components(
self,
components: &'a [Component]
) -> Result<Self, CreateFollowupMessageError>
Add multiple Components to a message.
Calling this method multiple times will clear previous calls.
Errors
Returns an CreateFollowupMessageErrorType::ComponentCount error type
if too many components are provided.
Returns an CreateFollowupMessageErrorType::ComponentInvalid error
type if one of the provided components is invalid.
The content of the webook’s message.
Up to 2000 UTF-16 codepoints.
Set the list of embeds of the webhook’s message.
Attach multiple files to the webhook.
JSON encoded body of any additional request fields.
If this method is called, all other fields are ignored, except for
file. See Discord Docs/Create Message.
Examples
Without payload_json:
use std::env;
use twilight_embed_builder::EmbedBuilder;
use twilight_http::Client;
use twilight_model::id::{MessageId, ApplicationId};
let client = Client::new(env::var("DISCORD_TOKEN")?);
client.set_application_id(ApplicationId::new(1).expect("non zero"));
let message = client.create_followup_message("token here")?
.content("some content")
.embeds(&[EmbedBuilder::new().title("title").build()?])
.exec()
.await?
.model()
.await?;
assert_eq!(message.content, "some content");With payload_json:
use std::env;
use twilight_http::Client;
use twilight_model::id::{MessageId, ApplicationId};
let client = Client::new(env::var("DISCORD_TOKEN")?);
client.set_application_id(ApplicationId::new(1).expect("non zero"));
let message = client.create_followup_message("token here")?
.content("some content")
.payload_json(br#"{ "content": "other content", "embeds": [ { "title": "title" } ] }"#)
.exec()
.await?
.model()
.await?;
assert_eq!(message.content, "other content");Specify the username of the webhook’s 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.
Auto Trait Implementations
impl<'a> !RefUnwindSafe for CreateFollowupMessage<'a>
impl<'a> Send for CreateFollowupMessage<'a>
impl<'a> Sync for CreateFollowupMessage<'a>
impl<'a> Unpin for CreateFollowupMessage<'a>
impl<'a> !UnwindSafe for CreateFollowupMessage<'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