Skip to main content

Bot

Trait Bot 

Source
pub trait Bot: Sized + Send {
    // Required method
    fn run(self) -> impl Future<Output = Result<BotHandle, BotError>> + Send;
}
Expand description

Unified Bot trait that hides connection mode differences

Both Discord (WebSocket) and Telegram (HTTP webhook) bots implement this trait, providing a consistent API regardless of the underlying transport mechanism.

Required Methods§

Source

fn run(self) -> impl Future<Output = Result<BotHandle, BotError>> + Send

Run the bot and start processing events

Returns a handle that can be used to control the bot (shutdown, etc.)

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§