Expand description
Make cool Telegram bots with Rust easily. Here is a simple echo bot:
use tbot::prelude::*;
#[tokio::main]
async fn main() {
let mut bot = tbot::from_env!("BOT_TOKEN").event_loop();
bot.text(|context| async move {
let echo = &context.text.value;
let call_result = context.send_message(echo).call().await;
if let Err(err) = call_result {
dbg!(err);
}
});
bot.polling().start().await.unwrap();
}
There are many examples to see tbot
in action. If you want to see
real-world use of tbot
, check out this list.
If you’re a newcomer, we recommend you go through the tutorial first.
We also have several How-to guides to help you use tbot
.
You can always refer to our API docs on docs.rs
(also, docs for master
are available here).
If you have a question, ask it in our group on Telegram. If you find a bug, file an issue on either our GitLab or GitHub repository.
Re-exports§
pub use event_loop::EventLoop;
pub use hyper_proxy as proxy;
Modules§
- Contexts for update handlers.
- Types representing errors.
- The event loop for handling bot updates.
- Utilities for working with markup.
- Structs for calling API methods.
- Useful predicates and utilities for them.
- Traits needed when working with
tbot
. - The stateful event loop and utilities for it.
- Types for interacting with the API.
- A few useful utilities.
Macros§
- Constructs a new
Bot
, extracting the token from the environment at compile time.
Structs§
- Provides methods to call the Bots API.