Expand description
§rust-tg-bot
Complete, asynchronous Telegram Bot API framework for Rust, faithfully ported from python-telegram-bot.
This is the facade crate that re-exports everything from:
rust_tg_bot_raw— Bot API types and methodsrust_tg_bot_ext— Application framework (handlers, filters, persistence)
§Quick Start
[dependencies]
rust-tg-bot = "1.0"ⓘ
use rust_tg_bot::ext::prelude::*;
#[tokio::main]
async fn main() {
let app = ApplicationBuilder::new()
.token(std::env::var("TELEGRAM_BOT_TOKEN").unwrap())
.build();
app.add_handler(CommandHandler::new("start", start), 0).await;
app.run_polling().await.unwrap();
}Re-exports§
pub use rust_tg_bot_raw as raw;pub use rust_tg_bot_ext as ext;
Modules§
- error
- Error types used throughout the crate.
- prelude
- Convenient re-exports for writing clean bot code. Convenient re-exports for writing clean Telegram bot code.
- types
- All Telegram API object types (User, Chat, Message, Update, etc.).
Structs§
- Bot
- The core Telegram Bot API client.
- Runtime
Config - Runtime configuration for
run.
Functions§
- run
Deprecated - Run an async entry point with a tokio runtime configured for Telegram bot workloads.
- run_
configured - Like
run, but with explicitRuntimeConfig.