Skip to main content

SlashCommand

Trait SlashCommand 

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

Source

fn name(&self) -> &str

Command name (without the leading /).

Source

fn description(&self) -> &str

Short description shown in /help.

Source

fn execute(&self, args: &str, ctx: &CommandContext) -> CommandOutput

Execute the command with the given arguments.

Provided Methods§

Source

fn usage(&self) -> Option<&str>

Optional usage hint (e.g., /model <provider/model>).

Implementors§