pub struct ModalInteraction { /* private fields */ }Expand description
A modal-submit interaction given to a Client::modal route
(D-252): dereferences to the ModalSubmitData (text_value, selected_users, …),
with the args of its custom ID, and answers through
InteractionExt.
discord.js counterpart: ModalSubmitInteraction.
Implementations§
Source§impl ModalInteraction
impl ModalInteraction
Sourcepub fn interaction(&self) -> &Interaction
pub fn interaction(&self) -> &Interaction
Returns the whole interaction: its guild, channel, member, locale, …
discord.js counterpart: the interaction itself (discord.js routes nothing).
Sourcepub const fn event(&self) -> &Arc<InteractionCreate> ⓘ
pub const fn event(&self) -> &Arc<InteractionCreate> ⓘ
Returns the event payload, shared with the
InteractionCreate handlers.
discord.js counterpart: the event’s arguments.
Methods from Deref<Target = ModalSubmitData>§
Sourcepub fn get(&self, custom_id: &str) -> Option<&SubmittedComponent>
pub fn get(&self, custom_id: &str) -> Option<&SubmittedComponent>
Finds the submitted input with the given custom ID, inside labels and action rows.
discord.js counterpart: ModalSubmitFields#getField.
Sourcepub fn text_value(&self, custom_id: &str) -> Option<&str>
pub fn text_value(&self, custom_id: &str) -> Option<&str>
Returns the text entered in the text input with the given custom ID.
discord.js counterpart: ModalSubmitFields#getTextInputValue.
Sourcepub fn string_select_values(&self, custom_id: &str) -> Option<&[CompactString]>
pub fn string_select_values(&self, custom_id: &str) -> Option<&[CompactString]>
Returns the values chosen in the string select menu custom_id.
discord.js counterpart: ModalSubmitFields#getStringSelectValues.
Sourcepub fn checkbox_group_values(&self, custom_id: &str) -> Option<&[CompactString]>
pub fn checkbox_group_values(&self, custom_id: &str) -> Option<&[CompactString]>
Returns the values of the checked boxes of the checkbox group custom_id.
discord.js counterpart: ModalSubmitFields#getCheckboxGroup.
Sourcepub fn radio_group_value(&self, custom_id: &str) -> Option<&str>
pub fn radio_group_value(&self, custom_id: &str) -> Option<&str>
Returns the value chosen in the radio group custom_id (None also when nothing was
chosen).
discord.js counterpart: ModalSubmitFields#getRadioGroup.
Sourcepub fn checkbox_value(&self, custom_id: &str) -> Option<bool>
pub fn checkbox_value(&self, custom_id: &str) -> Option<bool>
Returns whether the checkbox custom_id was checked.
discord.js counterpart: ModalSubmitFields#getCheckbox.
Sourcepub fn selected_users<'a>(
&'a self,
custom_id: &str,
) -> Option<impl Iterator<Item = &'a User> + use<'a>>
pub fn selected_users<'a>( &'a self, custom_id: &str, ) -> Option<impl Iterator<Item = &'a User> + use<'a>>
Returns the users chosen in the user or mentionable select menu custom_id.
discord.js counterpart: ModalSubmitFields#getSelectedUsers.
Sourcepub fn selected_members<'a>(
&'a self,
custom_id: &str,
) -> Option<impl Iterator<Item = (&'a User, &'a InteractionMember)> + use<'a>>
pub fn selected_members<'a>( &'a self, custom_id: &str, ) -> Option<impl Iterator<Item = (&'a User, &'a InteractionMember)> + use<'a>>
Returns the users chosen in the user or mentionable select menu custom_id, with their
member data (in guilds).
discord.js counterpart: ModalSubmitFields#getSelectedMembers.
Sourcepub fn selected_roles<'a>(
&'a self,
custom_id: &str,
) -> Option<impl Iterator<Item = &'a Role> + use<'a>>
pub fn selected_roles<'a>( &'a self, custom_id: &str, ) -> Option<impl Iterator<Item = &'a Role> + use<'a>>
Returns the roles chosen in the role or mentionable select menu custom_id.
discord.js counterpart: ModalSubmitFields#getSelectedRoles.
Sourcepub fn selected_channels<'a>(
&'a self,
custom_id: &str,
) -> Option<impl Iterator<Item = &'a InteractionChannel> + use<'a>>
pub fn selected_channels<'a>( &'a self, custom_id: &str, ) -> Option<impl Iterator<Item = &'a InteractionChannel> + use<'a>>
Returns the channels chosen in the channel select menu custom_id.
discord.js counterpart: ModalSubmitFields#getSelectedChannels.
Sourcepub fn selected_mentionables<'a>(
&'a self,
custom_id: &str,
) -> Option<impl Iterator<Item = Mentionable<'a>> + use<'a>>
pub fn selected_mentionables<'a>( &'a self, custom_id: &str, ) -> Option<impl Iterator<Item = Mentionable<'a>> + use<'a>>
Returns the users and roles chosen in the mentionable select menu custom_id.
discord.js counterpart: ModalSubmitFields#getSelectedMentionables.
Sourcepub fn uploaded_files<'a>(
&'a self,
custom_id: &str,
) -> Option<impl Iterator<Item = &'a Attachment> + use<'a>>
pub fn uploaded_files<'a>( &'a self, custom_id: &str, ) -> Option<impl Iterator<Item = &'a Attachment> + use<'a>>
Returns the files uploaded in the file upload custom_id.
discord.js counterpart: ModalSubmitFields#getUploadedFiles.
Trait Implementations§
Source§impl Clone for ModalInteraction
impl Clone for ModalInteraction
impl Collectable for ModalInteraction
Source§impl Debug for ModalInteraction
impl Debug for ModalInteraction
Source§impl Deref for ModalInteraction
impl Deref for ModalInteraction
Source§type Target = ModalSubmitData
type Target = ModalSubmitData
Source§fn deref(&self) -> &ModalSubmitData
fn deref(&self) -> &ModalSubmitData
Source§impl InteractionExt for ModalInteraction
impl InteractionExt for ModalInteraction
Source§fn reply<B: Backend>(
&self,
ctx: &Context<B>,
body: impl Into<MessageCallbackData>,
) -> impl Future<Output = Result<(), Error>> + Send
fn reply<B: Backend>( &self, ctx: &Context<B>, body: impl Into<MessageCallbackData>, ) -> impl Future<Output = Result<(), Error>> + Send
ChannelMessageWithSource);
accepts anything that converts into MessageCallbackData, such as &str. Set
MessageFlags::EPHEMERAL in its flags for a message only the user sees. Read moreSource§fn defer_reply<B: Backend>(
&self,
ctx: &Context<B>,
flags: MessageFlags,
) -> impl Future<Output = Result<(), Error>> + Send
fn defer_reply<B: Backend>( &self, ctx: &Context<B>, flags: MessageFlags, ) -> impl Future<Output = Result<(), Error>> + Send
DeferredChannelMessageWithSource);
the message follows with edit_reply. flags can only be
MessageFlags::EPHEMERAL (for an ephemeral message) or empty. Read moreSource§fn update<B: Backend>(
&self,
ctx: &Context<B>,
body: impl Into<MessageCallbackData>,
) -> impl Future<Output = Result<(), Error>> + Send
fn update<B: Backend>( &self, ctx: &Context<B>, body: impl Into<MessageCallbackData>, ) -> impl Future<Output = Result<(), Error>> + Send
UpdateMessage): fields left None keep their
value. Component interactions and modals opened from a component. Read moreSource§fn defer_update<B: Backend>(
&self,
ctx: &Context<B>,
) -> impl Future<Output = Result<(), Error>> + Send
fn defer_update<B: Backend>( &self, ctx: &Context<B>, ) -> impl Future<Output = Result<(), Error>> + Send
DeferredUpdateMessage); the message
can be edited later with edit_reply. Read moreSource§fn show_modal<B: Backend>(
&self,
ctx: &Context<B>,
modal: ModalCallbackData,
) -> impl Future<Output = Result<(), Error>> + Send
fn show_modal<B: Backend>( &self, ctx: &Context<B>, modal: ModalCallbackData, ) -> impl Future<Output = Result<(), Error>> + Send
Source§fn respond<B: Backend>(
&self,
ctx: &Context<B>,
choices: AutocompleteChoices,
) -> impl Future<Output = Result<(), Error>> + Send
fn respond<B: Backend>( &self, ctx: &Context<B>, choices: AutocompleteChoices, ) -> impl Future<Output = Result<(), Error>> + Send
AutocompleteResult); up to 25, typed like
the option. An empty list shows “no suggestions”. Read moreSource§fn launch_activity<B: Backend>(
&self,
ctx: &Context<B>,
) -> impl Future<Output = Result<(), Error>> + Send
fn launch_activity<B: Backend>( &self, ctx: &Context<B>, ) -> impl Future<Output = Result<(), Error>> + Send
LaunchActivity;
apps with Activities enabled). Read moreSource§fn fetch_reply<B: Backend>(
&self,
ctx: &Context<B>,
) -> impl Future<Output = Result<Arc<CachedMessage>, Error>> + Send
fn fetch_reply<B: Backend>( &self, ctx: &Context<B>, ) -> impl Future<Output = Result<Arc<CachedMessage>, Error>> + Send
Source§fn edit_reply<B: Backend>(
&self,
ctx: &Context<B>,
body: impl Into<EditWebhookMessage>,
) -> impl Future<Output = Result<Arc<CachedMessage>, Error>> + Send
fn edit_reply<B: Backend>( &self, ctx: &Context<B>, body: impl Into<EditWebhookMessage>, ) -> impl Future<Output = Result<Arc<CachedMessage>, Error>> + Send
defer_reply is sent, and how a
defer_updated message is edited
(Edit Original Interaction Response).
Accepts anything that converts into an EditWebhookMessage, such as &str. Read moreSource§fn delete_reply<B: Backend>(
&self,
ctx: &Context<B>,
) -> impl Future<Output = Result<(), Error>> + Send
fn delete_reply<B: Backend>( &self, ctx: &Context<B>, ) -> impl Future<Output = Result<(), Error>> + Send
Source§fn follow_up<B: Backend>(
&self,
ctx: &Context<B>,
body: impl Into<CreateFollowupMessage>,
) -> impl Future<Output = Result<Arc<CachedMessage>, Error>> + Send
fn follow_up<B: Backend>( &self, ctx: &Context<B>, body: impl Into<CreateFollowupMessage>, ) -> impl Future<Output = Result<Arc<CachedMessage>, Error>> + Send
CreateFollowupMessage, such as &str. After a
defer_reply, the first follow-up replaces “thinking…”. Read moreSource§fn fetch_follow_up<B: Backend>(
&self,
ctx: &Context<B>,
message_id: MessageId,
) -> impl Future<Output = Result<Arc<CachedMessage>, Error>> + Send
fn fetch_follow_up<B: Backend>( &self, ctx: &Context<B>, message_id: MessageId, ) -> impl Future<Output = Result<Arc<CachedMessage>, Error>> + Send
Source§fn edit_follow_up<B: Backend>(
&self,
ctx: &Context<B>,
message_id: MessageId,
body: impl Into<EditWebhookMessage>,
) -> impl Future<Output = Result<Arc<CachedMessage>, Error>> + Send
fn edit_follow_up<B: Backend>( &self, ctx: &Context<B>, message_id: MessageId, body: impl Into<EditWebhookMessage>, ) -> impl Future<Output = Result<Arc<CachedMessage>, Error>> + Send
EditWebhookMessage, such as &str. Read moreSource§fn delete_follow_up<B: Backend>(
&self,
ctx: &Context<B>,
message_id: MessageId,
) -> impl Future<Output = Result<(), Error>> + Send
fn delete_follow_up<B: Backend>( &self, ctx: &Context<B>, message_id: MessageId, ) -> impl Future<Output = Result<(), Error>> + Send
Source§fn component_collector<B: Backend>(
&self,
ctx: &Context<B>,
) -> CollectorBuilder<ComponentInteraction>
fn component_collector<B: Backend>( &self, ctx: &Context<B>, ) -> CollectorBuilder<ComponentInteraction>
Source§fn await_component<B: Backend>(
&self,
ctx: &Context<B>,
) -> CollectorBuilder<ComponentInteraction, First>
fn await_component<B: Backend>( &self, ctx: &Context<B>, ) -> CollectorBuilder<ComponentInteraction, First>
Source§fn await_modal_submit<B: Backend>(
&self,
ctx: &Context<B>,
time: Duration,
) -> CollectorBuilder<ModalInteraction, First>
fn await_modal_submit<B: Backend>( &self, ctx: &Context<B>, time: Duration, ) -> CollectorBuilder<ModalInteraction, First>
time for the user of this interaction to submit a modal (D-268), usually
the one shown with show_modal. Add a
filter on the modal’s custom_id when several can be
open. time is required, as in discord.js: a closed modal sends nothing. Read moreAuto Trait Implementations§
impl Freeze for ModalInteraction
impl RefUnwindSafe for ModalInteraction
impl Send for ModalInteraction
impl Sync for ModalInteraction
impl Unpin for ModalInteraction
impl UnsafeUnpin for ModalInteraction
impl UnwindSafe for ModalInteraction
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Classify for T
impl<T> Classify for T
type Classified = T
fn classify(self) -> T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Declassify for T
impl<T> Declassify for T
type Declassified = T
fn declassify(self) -> T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more