Skip to main content

SlashCommand

Trait SlashCommand 

Source
pub trait SlashCommand: Send + Sync {
    // Required methods
    fn name(&self) -> &'static str;
    fn description(&self) -> &'static str;
    fn usage(&self) -> &'static str;
    fn execute<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        state: &'life1 mut ActorState,
        args: &'life2 [&'life3 str],
    ) -> Pin<Box<dyn Future<Output = Vec<ChatMessage>> + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;

    // Provided method
    fn hidden(&self) -> bool { ... }
}
Expand description

A slash command that can be provided by a module. Modules implement this trait for commands they want to register.

Required Methods§

Source

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

The command name without the leading slash (e.g., “memory” for /memory)

Source

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

Short description shown in help

Source

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

Usage example shown in help (e.g., “/memory summarize”)

Source

fn execute<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, state: &'life1 mut ActorState, args: &'life2 [&'life3 str], ) -> Pin<Box<dyn Future<Output = Vec<ChatMessage>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Execute the command with the given arguments

Provided Methods§

Source

fn hidden(&self) -> bool

Whether to hide this command from /help output

Implementors§