CommandExecutor

Trait CommandExecutor 

Source
pub trait CommandExecutor {
    // Required methods
    fn execute_with_result<'life0, 'life1, 'async_trait>(
        &'life0 self,
        bot: &'life1 Bot,
    ) -> Pin<Box<dyn Future<Output = CommandResult> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn name(&self) -> &'static str;

    // Provided method
    fn validate(&self) -> CliResult<()> { ... }
}
Expand description

New trait for commands that return structured results

Required Methods§

Source

fn execute_with_result<'life0, 'life1, 'async_trait>( &'life0 self, bot: &'life1 Bot, ) -> Pin<Box<dyn Future<Output = CommandResult> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Execute the command and return structured result

Source

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

Get command name for logging

Provided Methods§

Source

fn validate(&self) -> CliResult<()>

Validate command arguments before execution

Implementors§