Skip to main content

Crate rust_tg_bot_ext

Crate rust_tg_bot_ext 

Source
Expand description

Application framework for Telegram bots.

rust-tg-bot-ext provides the high-level handler/filter/persistence layer on top of rust_tg_bot_raw. It is modeled after Python’s python-telegram-bot extension package and offers:

§Quick start

use rust_tg_bot_ext::prelude::*;

async fn start(update: Update, context: Context) -> HandlerResult {
    context.reply_text(&update, "Hello!").await?;
    Ok(())
}

let app = ApplicationBuilder::new("BOT_TOKEN").build().await;
app.add_handler(CommandHandler::new("start", start), 0).await;
app.run_polling().await?;

Modules§

application
The core Application that dispatches updates to registered handlers. The core Application that dispatches updates to registered handlers.
builder
Builder for constructing an Application with custom configuration. Typestate builder for Application.
callback_data_cache
Cache for arbitrary callback-data payloads attached to inline keyboards. Arbitrary callback data cache.
context
The CallbackContext passed to handler callbacks. Callback context passed to handlers and error handlers.
context_types
Configuration types for context data categories. Customisable context type factories.
defaults
User-configurable defaults for outgoing API calls. Default parameter values for bot methods.
ext_bot
Extended bot wrapping the raw Bot with defaults, callback-data cache, and rate-limiter support. Extended bot with convenience features.
filters
Composable filters for routing updates to handlers. Filters for routing Telegram updates to handlers.
handlers
Update handler trait and concrete handler implementations. Update handler framework.
prelude
Convenient re-exports for writing clean bot code. Convenient re-exports for writing clean Telegram bot code.
update_processor
Base update processor abstraction. Semaphore-based concurrent update processing.
updater
The polling/webhook updater that feeds updates into the application. Fetches updates via long polling or webhook and pushes them into a channel.
utils
Internal utility types and helpers.