ExtractInteractionData

Trait ExtractInteractionData 

Source
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§

Source

fn command_data(self) -> Option<CommandData>

Extract CommandData from an interaction

Returns None if the interaction is not an application command

Source

fn component_data(self) -> Option<MessageComponentInteractionData>

Extract MessageComponentInteractionData from an interaction

Returns None if the interaction is not a message component

Source

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.

Source

fn modal_data(self) -> Option<ModalInteractionData>

Extract ModalInteractionData from an interaction

Returns None if the interaction is not a modal submit interaction.

Implementations on Foreign Types§

Source§

impl ExtractInteractionData for InteractionData

Implementors§