pub trait ExtractInteractionData {
// Required methods
fn command_data(self) -> Option<CommandData>;
fn component_data(self) -> Option<MessageComponentInteractionData>;
fn custom_id(&self) -> Option<&str>;
fn modal_data(self) -> Option<ModalInteractionData>;
}Expand description
Trait implemented on InteractionData to extract its variants without
using pattern matching
Required Methods§
Sourcefn command_data(self) -> Option<CommandData>
fn command_data(self) -> Option<CommandData>
Extract CommandData from an interaction
Returns None if the interaction is not an application command
Sourcefn component_data(self) -> Option<MessageComponentInteractionData>
fn component_data(self) -> Option<MessageComponentInteractionData>
Extract MessageComponentInteractionData from an interaction
Returns None if the interaction is not a message component
Sourcefn custom_id(&self) -> Option<&str>
fn custom_id(&self) -> Option<&str>
Extract the name or custom ID of an interaction
For InteractionData::ApplicationCommand, this returns the name, for
other kinds, it returns the custom ID
Returns None if the interaction is not a command, component or modal.
This is because InteractionData is marked non-exhaustive.
Sourcefn modal_data(self) -> Option<ModalInteractionData>
fn modal_data(self) -> Option<ModalInteractionData>
Extract ModalInteractionData from an interaction
Returns None if the interaction is not a modal submit interaction.