Crate teloxide

source ·
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::*;

log::info!("Starting throw dice bot...");

let bot = Bot::from_env();

teloxide::repl(bot, |bot: Bot, msg: Message| async move {

Cargo features

webhooksEnables general webhook utilities (almost useless on its own).
webhooks-axumEnables webhook implementation based on axum framework.
macrosRe-exports macros from teloxide-macros.
ctrlc_handlerEnables the DispatcherBuilder::enable_ctrlc_handler function (enabled by default).
auto-sendEnables the AutoSend bot adaptor (enabled by default; DEPRECATED).
throttleEnables the Throttle bot adaptor.
cache-meEnables the CacheMe bot adaptor.
trace-adaptorEnables the Trace bot adaptor.
erasedEnables the ErasedRequester bot adaptor.
fullEnables all the features except nightly.
nightlyEnables nightly-only features (see the teloxide-core features).
native-tlsEnables the native-tls TLS implementation (enabled by default).
rustlsEnables the rustls TLS implementation.
redis-storageEnables the Redis storage support for dialogues.
sqlite-storageEnables the Sqlite storage support for dialogues (depends on native-tls).
sqlite-storage-rustlsEnables the Sqlite storage support for dialogues (depends on rustls, conflicts with sqlite-storage).
cbor-serializerEnables the CBOR serializer for dialogues.
bincode-serializerEnables the Bincode serializer for dialogues.


pub use teloxide_macros as macros;
pub use dptree;


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.
REPLs for dispatching updates.
Telegram API requests.
Stopping asynchronous tasks, e.g., listeners.
Telegram API types.
Receiving updates from Telegram.
Some useful utilities.


Filters an enumeration, passing its payload forwards.


A requests sender.


A kind of an API error.
An error caused by downloading a file.
An error caused by sending a request to Telegram.


A REPL for commands.
A REPL for commands, with a custom UpdateListener.
Returns a handler that accepts a parsed command C.
A REPL for messages.
A REPL for messages, with a custom UpdateListener.
A shortcut for ResponseResult::Ok(val).