Skip to main content

Crate rust_tg_bot

Crate rust_tg_bot 

Source
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:

§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();
}

See the README and guide for full documentation.

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.
RuntimeConfig
Runtime configuration for run.

Functions§

runDeprecated
Run an async entry point with a tokio runtime configured for Telegram bot workloads.
run_configured
Like run, but with explicit RuntimeConfig.