#[non_exhaustive]pub struct ModalSubmitData {
pub custom_id: CompactString,
pub components: Vec<SubmittedComponent>,
pub resolved: Option<Box<Resolved>>,
}Expand description
The data of a modal-submit interaction: the values the user entered in the modal’s components.
discord.js counterpart: ModalSubmitInteraction (customId, fields).
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.custom_id: CompactStringThe modal’s custom ID.
components: Vec<SubmittedComponent>The submitted components, in the modal’s layout.
resolved: Option<Box<Resolved>>The selected users, members, roles, channels and uploaded attachments.
Implementations§
Source§impl ModalSubmitData
impl 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.
Source§impl ModalSubmitData
Reads submitted modal fields by custom ID and component type (D-250); see also
get and text_value.
impl ModalSubmitData
Reads submitted modal fields by custom ID and component type (D-250); see also
get and text_value.
Each getter returns None when no component has the custom ID or it is of another type;
the selected_* getters return the resolved objects in the order they
were selected.
discord.js counterpart: ModalSubmitFields.
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.