telegram-notify 1.0.0

Tiny async Rust crate for sending Telegram bot messages
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use teloxide::prelude::*;

/// Prints the chat ID for incoming messages sent to the bot.
///
/// Run this example, then send any message to your bot in Telegram.
/// The program will print the chat ID you should store as `TELEGRAM_CHAT_ID`.
#[tokio::main]
async fn main() {
    let bot = Bot::new(std::env::var("TELEGRAM_BOT_TOKEN").expect("missing TELEGRAM_BOT_TOKEN"));

    teloxide::repl(bot, |msg: Message| async move {
        println!("chat_id = {}", msg.chat.id.0);
        respond(())
    })
    .await;
}