All Projects → telegram-rs → Telegram Bot

telegram-rs / Telegram Bot

Licence: mit
Rust Library for creating a Telegram Bot

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to Telegram Bot

Pytg
Python package that wraps around Telegram messenger CLI. Send and receive messages, and more.
Stars: ✭ 365 (-42.34%)
Mutual labels:  telegram-bot, telegram
Telegram Tutorial
Уроки по написанию своих Telegram-ботов
Stars: ✭ 409 (-35.39%)
Mutual labels:  telegram-bot, telegram
Userge
Userge, Durable as a Serge
Stars: ✭ 363 (-42.65%)
Mutual labels:  telegram-bot, telegram
Shieldy
@shieldy_bot Telegram bot repository
Stars: ✭ 351 (-44.55%)
Mutual labels:  telegram-bot, telegram
Tgbot Cpp
C++ library for Telegram bot API
Stars: ✭ 439 (-30.65%)
Mutual labels:  telegram-bot, telegram
Webhook2telegram
🤖 A simple bot to translate JSON HTTP requests into Telegram push messages
Stars: ✭ 357 (-43.6%)
Mutual labels:  telegram-bot, telegram
Trashemail
A hosted disposable email telegram bot; Extremely privacy friendly; Proudly hosted for community.
Stars: ✭ 408 (-35.55%)
Mutual labels:  telegram-bot, telegram
Laravel Social Auto Posting
🌈Laravel social auto posting
Stars: ✭ 306 (-51.66%)
Mutual labels:  telegram-bot, telegram
Mtproto
Full-native go implementation of Telegram API
Stars: ✭ 566 (-10.58%)
Mutual labels:  telegram-bot, telegram
Telegram Bot
Ruby gem for building Telegram Bot with optional Rails integration
Stars: ✭ 433 (-31.6%)
Mutual labels:  telegram-bot, telegram
Kotlin Telegram Bot
🤖 A wrapper for the Telegram Bot API written in Kotlin
Stars: ✭ 337 (-46.76%)
Mutual labels:  telegram-bot, telegram
Shell Bot
🤖 Telegram bot that executes commands and sends the live output
Stars: ✭ 470 (-25.75%)
Mutual labels:  telegram-bot, telegram
Telegram Action
GitHub Action that sends a Telegram message.
Stars: ✭ 318 (-49.76%)
Mutual labels:  telegram-bot, telegram
Unifiedmessagerelay
Group Message Forward Framework (supports QQ Telegram Line Discord)
Stars: ✭ 363 (-42.65%)
Mutual labels:  telegram-bot, telegram
Telegram
Telegram Bot API Wrapper for Scala
Stars: ✭ 310 (-51.03%)
Mutual labels:  telegram-bot, telegram
Groupbutler
This bot can help you in managing your group with rules, anti-flood, description, custom triggers, and much more!
Stars: ✭ 399 (-36.97%)
Mutual labels:  telegram-bot, telegram
remoteTelegramShell
control your Linux OS computer through Telegram
Stars: ✭ 73 (-88.47%)
Mutual labels:  telegram, telegram-bot
The Guard Bot
The Guard, a Telegram bot to moderate groups.
Stars: ✭ 299 (-52.76%)
Mutual labels:  telegram-bot, telegram
Pytelegrambotapi
Python Telegram bot api.
Stars: ✭ 4,986 (+687.68%)
Mutual labels:  telegram-bot, telegram
Telegram
✈️ Telegram Notifications Channel for Laravel
Stars: ✭ 450 (-28.91%)
Mutual labels:  telegram-bot, telegram

Rust Telegram Bot Library

Build Status Tests Tests License Crates.io

Documentation: Latest crates.io version master

A library for writing your own Telegram bots. More information here. Official API here.

Example

Here is a simple example (see example/simple.rs):

use std::env;

use futures::StreamExt;
use telegram_bot::*;

#[tokio::main]
async fn main() -> Result<(), Error> {
    let token = env::var("TELEGRAM_BOT_TOKEN").expect("TELEGRAM_BOT_TOKEN not set");
    let api = Api::new(token);

    // Fetch new updates via long poll method
    let mut stream = api.stream();
    while let Some(update) = stream.next().await {
        // If the received update contains a new message...
        let update = update?;
        if let UpdateKind::Message(message) = update.kind {
            if let MessageKind::Text { ref data, .. } = message.kind {
                // Print received text message to stdout.
                println!("<{}>: {}", &message.from.first_name, data);

                // Answer message with "Hi".
                api.send(message.text_reply(format!(
                    "Hi, {}! You just wrote '{}'",
                    &message.from.first_name, data
                )))
                .await?;
            }
        }
    }
    Ok(())
}

You can find a bigger examples in the examples.

Usage

This library is available via crates.io. In order to use it, just add this to your Cargo.toml:

telegram-bot = "0.7"

The library allows you to do E2E-testing of your bot easily: just specify TELEGRAM_API_URL environment variable to point to your fake Telegram test server. A lot of diagnostic information can be collected with tracing framework, see example/tracing.rs).

Collaboration

Yes please! Every type of contribution is welcome: Create issues, hack some code or make suggestions. Don't know where to start? Good first issues are tagged with up for grab.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].