rust_telegram_bot

Crates.iorust_telegram_bot
lib.rsrust_telegram_bot
version0.0.1
sourcesrc
created_at2023-09-20 11:10:50.327454
updated_at2023-09-20 11:10:50.327454
descriptionTelegramBot API implementation
homepage
repositoryhttps://github.com/NeverDieOne/rust_telegram_bot
max_upload_size
id978037
size34,243
Artem Petryakov (NeverDieOne)

documentation

README

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");
}
Commit count: 3

cargo fmt