pub trait SlashCommand: Send + Sync {
// Required methods
fn name(&self) -> &str;
fn description(&self) -> &str;
fn execute(&self, args: &str, ctx: &CommandContext) -> CommandOutput;
// Provided method
fn usage(&self) -> Option<&str> { ... }
}Expand description
Trait for implementing slash commands.
Implement this trait to add custom commands to the session.
Required Methods§
Sourcefn description(&self) -> &str
fn description(&self) -> &str
Short description shown in /help.
Sourcefn execute(&self, args: &str, ctx: &CommandContext) -> CommandOutput
fn execute(&self, args: &str, ctx: &CommandContext) -> CommandOutput
Execute the command with the given arguments.
Provided Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".