1 unstable release
0.0.1 | Sep 20, 2023 |
---|
#113 in #telegram-bot
11KB
142 lines
Telegram Bot
Имплементация TelegramBot API на Rust
Пример использования
use rust_telegram_bot::ext::{
updater::Updater,
context::Context
};
use rust_telegram_bot::telegram::types::Update;
fn echo(update: &Update, context: &Context) {
let user_id = update.get_effective_user().id;
let text = &update.message.text;
let _ = context.bot.send_message(user_id as i32, text);
}
fn main() {
let mut updater = Updater::new(String::from("YOUR TOKEN"));
updater.register_handler(echo);
updater.start_polling().expect("Something went wrong");
}
Dependencies
~4–19MB
~222K SLoC