Skip to main content

SlashCommand

Trait SlashCommand 

Source
pub trait SlashCommand: Send + Sync {
    // Required methods
    fn name(&self) -> &'static str;
    fn register(&self) -> CreateCommand;
    fn run<'life0, 'async_trait>(
        &'life0 self,
        ctx: Context,
        command: CommandInteraction,
        config: Config,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Trait for slash commands.

Required Methods§

Source

fn name(&self) -> &'static str

The command name (must match Discord command name).

Source

fn register(&self) -> CreateCommand

Register the command with Discord.

Source

fn run<'life0, 'async_trait>( &'life0 self, ctx: Context, command: CommandInteraction, config: Config, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Execute the command.

Implementors§