Skip to main content

BotProtocol

Trait BotProtocol 

Source
pub trait BotProtocol: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn on_message<'life0, 'async_trait>(
        &'life0 self,
        message: BotMessage,
    ) -> Pin<Box<dyn Future<Output = Result<BotResponse>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn on_command<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        command: &'life1 str,
        args: &'life2 [&'life3 str],
    ) -> Pin<Box<dyn Future<Output = Result<BotResponse>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn start<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn stop<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Bot protocol for chat integrations.

Required Methods§

Source

fn name(&self) -> &str

Get bot name

Source

fn on_message<'life0, 'async_trait>( &'life0 self, message: BotMessage, ) -> Pin<Box<dyn Future<Output = Result<BotResponse>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Handle incoming message

Source

fn on_command<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, command: &'life1 str, args: &'life2 [&'life3 str], ) -> Pin<Box<dyn Future<Output = Result<BotResponse>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Handle command

Source

fn start<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Start the bot

Source

fn stop<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Stop the bot

Implementors§