mobot
is a Telegram chat framework written in Rust. It comes with a fully native implementation of the
Telegram Bot API.
MIT Licensed. Copyright 2023 Mohit Muthanna Cheppudira.
FakeBot
), to simplify writing unit tests for your bots.Bot that replies with "Hello world!" to every message. Working example in src/bin/hello.rs
.
```rust use mobot::*;
async fn main() { let client = Client::new(std::env::var("TELEGRAM_TOKEN").unwrap().into()); let mut router = Router::new(client);
router.add_chat_route(Route::Default, |_, _: chat::State<()>| async move {
Ok(chat::Action::ReplyText("Hello world!".into()))
}).await;
router.start().await;
} ```
See full API documentation at https://docs.rs/mobot.
This crate requires OpenSSL and pkg-config
:
sudo apt-get install pkg-config libssl-dev