pub struct InteractionResponseDataBuilder(/* private fields */);use the interaction_response builders instead
builder only.Expand description
Create an [InteractionResponseData] with a builder.
§Example
use twilight_model::channel::message::{
MessageFlags,
component::{ActionRow, Button, ButtonStyle, Component},
};
use twilight_util::builder::InteractionResponseDataBuilder;
let component = Component::ActionRow(ActionRow {
id: None,
components: Vec::from([Component::Button(Button {
id: None,
style: ButtonStyle::Primary,
emoji: None,
label: Some("Button label".to_string()),
custom_id: Some("button_id".to_string()),
url: None,
disabled: false,
sku_id: None,
})]),
});
let interaction_response_data = InteractionResponseDataBuilder::new()
.content("Callback message")
.flags(MessageFlags::EPHEMERAL)
.components([component.clone()])
.build();
assert_eq!(interaction_response_data.components, Some(vec![component]));Implementations§
Source§impl InteractionResponseDataBuilder
impl InteractionResponseDataBuilder
Sourcepub fn build(self) -> InteractionResponseData
pub fn build(self) -> InteractionResponseData
Consume the builder, returning an [InteractionResponseData].
Sourcepub fn allowed_mentions(self, allowed_mentions: AllowedMentions) -> Self
pub fn allowed_mentions(self, allowed_mentions: AllowedMentions) -> Self
Set the [AllowedMentions] of the callback.
Defaults to None.
Sourcepub fn attachments(
self,
attachments: impl IntoIterator<Item = Attachment>,
) -> Self
pub fn attachments( self, attachments: impl IntoIterator<Item = Attachment>, ) -> Self
Set the attachments of the message.
Defaults to None.
Sourcepub fn choices(
self,
choices: impl IntoIterator<Item = CommandOptionChoice>,
) -> Self
pub fn choices( self, choices: impl IntoIterator<Item = CommandOptionChoice>, ) -> Self
Set the autocomplete choices of the response.
Only valid when the type of the interaction is
ApplicationCommandAutocompleteResult.
Sourcepub fn components(self, components: impl IntoIterator<Item = Component>) -> Self
pub fn components(self, components: impl IntoIterator<Item = Component>) -> Self
Set the message [Component]s of the callback.
Defaults to None.
Sourcepub fn content(self, content: impl Into<String>) -> Self
pub fn content(self, content: impl Into<String>) -> Self
Set the message content of the callback.
Defaults to None.
Sourcepub fn custom_id(self, custom_id: impl Into<String>) -> Self
pub fn custom_id(self, custom_id: impl Into<String>) -> Self
Set the custom ID of the callback.
Defaults to None.
Sourcepub fn embeds(self, embeds: impl IntoIterator<Item = Embed>) -> Self
pub fn embeds(self, embeds: impl IntoIterator<Item = Embed>) -> Self
Set the [Embed]s of the callback.
Defaults to an empty list.
Sourcepub const fn flags(self, flags: MessageFlags) -> Self
pub const fn flags(self, flags: MessageFlags) -> Self
Set the [MessageFlags].
The only supported flags are EPHEMERAL and SUPPRESS_EMBEDS.
Defaults to None.
Sourcepub fn title(self, title: impl Into<String>) -> Self
pub fn title(self, title: impl Into<String>) -> Self
Set the title of the callback.
Defaults to None.
Trait Implementations§
Source§impl Clone for InteractionResponseDataBuilder
impl Clone for InteractionResponseDataBuilder
Source§fn clone(&self) -> InteractionResponseDataBuilder
fn clone(&self) -> InteractionResponseDataBuilder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more