Introducing `tbot`, a crate for writing Telegram bots

A friend of mine and I have been working on a crate which makes it easy to
write Telegram bots in Rust. A simple example:

use tbot::prelude::*;

fn main() {
    let mut bot = tbot::bot!("BOT_TOKEN").event_loop();

    bot.text(|context| {
        let reply = context
            .send_message(&context.text.value)
            .into_future()
            .map_err(|err| {
                dbg!(err);
            });

        tbot::spawn(reply);
    });

    bot.polling().start();
}

Also, tbot supports all methods from the Bots API, as well as webhooks.

tbot is available on crates.io:

[dependencies]
tbot = "0.1"

And the source code is available on GitLab.

4 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.