teleborg
A loose Telegram bot API for Rust based on the traiting system. This project is inspired by python-telegram-bot.
How to use the project
Add this to your Cargo.toml
[]
= { = "https://github.com/voider1/teleborg" }
I will add this project to crates.io in the future when it's in a more complete state. Note that this project only works on Rust 1.16 or above.
An example
Here we'll show you the bare minimum needed to register a command which sends a hardcoded reply when issued.
extern crate teleborg;
use dispatcher;
use Bot;
use Update;
use updater;
// Our first command handler
Currently I only support send_message, reply_to_message and forward_message. More is to come. I recommend not putting your token in the code, if you pass None as teleborg::updater::Updater::Start()'s first argument it'll automatically search for a environment variable called "TELEGRAM_BOT_TOKEN". Just make sure you set the environment variable equal to your bot token and all is good.