Trait Command

Source
pub trait Command: Send + Sync {
    // Required method
    fn execute<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
        &'life0 self,
        client: &'life1 Client,
        token: &'life2 str,
        channel_id: &'life3 str,
        args: &'life4 str,
    ) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait,
             'life4: 'async_trait;
}
Expand description

The Command trait defines a common interface for all commands. Each command must implement the execute method which handles the command’s logic.

Required Methods§

Source

fn execute<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, client: &'life1 Client, token: &'life2 str, channel_id: &'life3 str, args: &'life4 str, ) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait,

Execute the command.

§Arguments
  • client - The HTTP client used to send requests.
  • token - The bot token for authentication.
  • channel_id - The ID of the channel where the command was invoked.
  • args - The arguments passed to the command.
§Returns

A result indicating success or failure.

Implementors§