Expand description
A full-featured framework that empowers you to easily build Telegram bots using Rust. It handles all the difficult stuff so you can focus only on your business logic.
For a high-level overview, see our GitHub repository.
use teloxide::prelude::*;
pretty_env_logger::init();
log::info!("Starting throw dice bot...");
let bot = Bot::from_env();
teloxide::repl(bot, |bot: Bot, msg: Message| async move {
bot.send_dice(msg.chat.id).await?;
Ok(())
})
.await;

Cargo features
Feature | Description |
---|---|
webhooks | Enables general webhook utilities (almost useless on its own). |
webhooks-axum | Enables webhook implementation based on axum framework. |
macros | Re-exports macros from teloxide-macros . |
ctrlc_handler | Enables the DispatcherBuilder::enable_ctrlc_handler function (enabled by default). |
auto-send | Enables the AutoSend bot adaptor (enabled by default; DEPRECATED). |
throttle | Enables the Throttle bot adaptor. |
cache-me | Enables the CacheMe bot adaptor. |
trace-adaptor | Enables the Trace bot adaptor. |
erased | Enables the ErasedRequester bot adaptor. |
full | Enables all the features except nightly . |
nightly | Enables nightly-only features (see the teloxide-core features). |
native-tls | Enables the native-tls TLS implementation (enabled by default). |
rustls | Enables the rustls TLS implementation. |
redis-storage | Enables the Redis storage support for dialogues. |
sqlite-storage | Enables the Sqlite storage support for dialogues (depends on native-tls ). |
sqlite-storage-rustls | Enables the Sqlite storage support for dialogues (depends on rustls , conflicts with sqlite-storage ). |
cbor-serializer | Enables the CBOR serializer for dialogues. |
bincode-serializer | Enables the Bincode serializer for dialogues. |
Re-exports
pub use teloxide_macros as macros;
pub use dptree;
Modules
Wrappers altering functionality of a bot.
An update dispatching model based on
dptree
.Convenient error handling.
Possible error types.
Network-specific API.
Request data sent to Telegram.
Commonly used items.
Telegram API requests.
Telegram API types.
Receiving updates from Telegram.
Some useful utilities.
Macros
Filters an enumeration, passing its payload forwards.
Structs
A requests sender.
Enums
A kind of an API error.
An error caused by downloading a file.
An error caused by sending a request to Telegram.
Functions
A REPL for commands.
A REPL for commands, with a custom
UpdateListener
.Returns a handler that accepts a parsed command
C
.repl_with_listener
ctrlc_handler
A REPL for messages, with a custom
UpdateListener
.A shortcut for
ResponseResult::Ok(val)
.