pub trait Bot: Sized + BotBounds {
// Required method
fn run_until(
self,
shutdown: Shutdown,
) -> impl BotFutureBounds<Output = Result<(), BotError>>;
// Provided method
fn run(self) -> impl BotFutureBounds<Output = Result<(), BotError>> { ... }
}Expand description
Unified Bot trait that hides connection mode differences
Every adapter — Discord’s gateway, Telegram’s long polling, and Matrix’s sync loop — exposes the same entry point: run until told to stop.
§Example
ⓘ
use botkit_core::{Bot, Shutdown};
// Run until the process is killed.
bot.run().await?;
// Or run until something else signals shutdown.
let (signal, shutdown) = Shutdown::channel();
let task = spawn(bot.run_until(shutdown));
signal.shutdown();
task.await?;Required Methods§
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".