[][src]Crate tbot

Make cool Telegram bots with Rust easily. Here is a simple echo bot:

use tbot::prelude::*;

let mut bot = tbot::bot!("BOT_TOKEN").event_loop();

bot.text(|context| {
    let reply = context
        .send_message(&context.text.value)
        .into_future()
        .map_err(|err| {
            dbg!(err);
        });

    tbot::spawn(reply);
});

bot.polling().start();

If you're new to tbot, we recommend you go through the tutorial first. We also have several How-to guides with snippets to solve your problems.

If you have a question, ask it in our group on Telegram. If you find a bug, fill an issue on either our GitLab or GitHub repository.

Re-exports

pub use event_loop::EventLoop;

Modules

connectors

A few common connectors for making requests.

contexts

Contexts for update handlers.

errors

Types representing errors.

event_loop

The event loop for handling bot updates.

methods

Structs for calling API methods.

prelude

Traits needed when working with tbot.

types

Types for interacting with the API.

Macros

bot

Constructs a new Bot, extracting the token from the environment at compile time.

Structs

Bot

Provides methods to call the Bots API.

Token

Represents a token.

Functions

run

A wrapper around tokio::run without F::Item: ().

spawn

A wrapper around tokio::spawn without F::Item: ().