1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
//! 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:
//!
//! - **Handlers**: [`CommandHandler`](handlers::command::CommandHandler),
//! [`MessageHandler`](handlers::message::MessageHandler),
//! [`CallbackQueryHandler`](handlers::callback_query::CallbackQueryHandler), etc.
//! - **Filters**: composable with `&`, `|`, `^`, `!` operators via [`F`](filters::base::F).
//! - **Persistence** *(feature `persistence`)*: in-memory
//! ([`DictPersistence`](persistence::dict::DictPersistence)) and JSON-file
//! ([`JsonFilePersistence`](persistence::json_file::JsonFilePersistence)).
//! - **Application**: the main dispatch loop ([`Application`](application::Application)).
//!
//! # Quick start
//!
//! ```rust,ignore
//! 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?;
//! ```
/// The core [`Application`](application::Application) that dispatches updates
/// to registered handlers.
/// Builder for constructing an [`Application`](application::Application) with
/// custom configuration.
/// Cache for arbitrary callback-data payloads attached to inline keyboards.
/// The [`CallbackContext`](context::CallbackContext) passed to handler callbacks.
/// Configuration types for context data categories.
/// User-configurable defaults for outgoing API calls.
/// Extended bot wrapping the raw [`Bot`](rust_tg_bot_raw::bot::Bot) with
/// defaults, callback-data cache, and rate-limiter support.
/// Composable filters for routing updates to handlers.
/// Update handler trait and concrete handler implementations.
/// Scheduled and repeating job execution.
///
/// Requires the `job-queue` feature.
/// Persistence backends for storing user/chat/bot data across restarts.
///
/// Requires the `persistence` feature.
/// Convenient re-exports for writing clean bot code.
/// Rate-limiter support.
///
/// Requires the `rate-limiter` feature.
/// Base update processor abstraction.
/// The polling/webhook updater that feeds updates into the application.
/// Internal utility types and helpers.