#telegram

telegram_notifyrs

Easily send single telegram messages!

3 releases

0.1.3 Dec 24, 2020
0.1.1 Oct 22, 2020
0.1.0 Oct 21, 2020

#106 in #telegram

Download history 3/week @ 2024-07-20 1/week @ 2024-07-27 2/week @ 2024-08-24 3/week @ 2024-08-31 10/week @ 2024-09-21 20/week @ 2024-09-28 1/week @ 2024-10-05

72 downloads per month

Custom license

15KB

telegram-notifyrs

CircleCI

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!

Usage

Include the crate under dependencies in your Cargo.toml

[dependencies]
telegram_notifyrs = "0.1.3"

Simple Example

use telegram_notifyrs;

telegram_notifyrs::send_message("This is my message".to_string(), "this-is-my-api-token", 1234567890);

Expanded Example

use std::env;
use telegram_notifyrs;

fn main() {
    let token = env::var("TELEGRAM_BOT_TOKEN").expect("TELEGRAM_BOT_TOKEN not set");
    let chat_id: i64 = env::var("TELEGRAM_CHAT_ID")
        .expect("Missing TELEGRAM_CHAT_ID environment variable")
        .parse()
        .expect("Error parsing TELEGRAM_CHAT_ID as i64");
    telegram_notifyrs::send_message("Test from library".to_string(), &token, chat_id);
}

Dependencies

~3–4.5MB
~82K SLoC