rust_telegram_bot 0.0.1

TelegramBot API implementation
Documentation
  • Coverage
  • 0%
    0 out of 40 items documented0 out of 14 items with examples
  • Size
  • Source code size: 33.76 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 4.33 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 1m 1s Average build duration of successful builds.
  • all releases: 1m 1s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • NeverDieOne

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");
}