A simple way to send messages via Telegram in Rust. I found it difficult to find a Crate for sending messages via Telegram without initializing a whole bot listener so I decided to make one. Feel free to open issues/PRs!
Include the crate under dependencies in your Cargo.toml
[dependencies]
telegram_notifyrs = "0.1.3"
``` use telegram_notifyrs;
telegramnotifyrs::sendmessage("This is my message".to_string(), "this-is-my-api-token", 1234567890); ```
``` use std::env; use telegram_notifyrs;
fn main() { let token = env::var("TELEGRAMBOTTOKEN").expect("TELEGRAMBOTTOKEN not set"); let chatid: i64 = env::var("TELEGRAMCHATID") .expect("Missing TELEGRAMCHATID environment variable") .parse() .expect("Error parsing TELEGRAMCHATID as i64"); telegramnotifyrs::sendmessage("Test from library".tostring(), &token, chat_id); } ```