Crate teloxide_core[][src]

Core part of the teloxide library.

This library provides tools for making requests to the Telegram Bot API (Currently, version 5.1 is supported) with ease. The library is fully asynchronouns and built using tokio.

 teloxide_core = "0.2"

Compiler support: requires rustc 1.49+

use teloxide_core::{
    prelude::*,
    types::{DiceEmoji, ParseMode},
};

let bot = Bot::from_env()
    .parse_mode(ParseMode::MarkdownV2)
    .auto_send();

let me = bot.get_me().await?;

bot.send_dice(chat_id).emoji(DiceEmoji::Dice).await?;
bot.send_message(
    chat_id,
    format!("Hi, my name is **{}** 👋", me.user.first_name),
)
.await?;

Cargo features

  • native-tls = use native-tls tls implementation (enabled by default)
  • rustls — use rustls tls implementation
  • auto_send — enables AutoSend bot adaptor
  • throttle — enables Throttle bot adaptor
  • cache_me — enables CacheMe bot adaptor
  • full — enables all features except nigthly
  • nightly — enables nigthly-only features, currently:
    • Removes some future boxing using #![feature(type_alias_impl_trait)]
    • Used to built docs (#![feature(doc_cfg, doc_spotlight)])

Modules

adaptors

Wrappers altering functionality of a bot.

net

Network-specific API.

payloads

Request data sent to Telegram.

prelude

Commonly used items.

requests

Telegram API requests.

types

Telergam API types.

Structs

Bot

A requests sender.

Enums

ApiError

A kind of an API error.

DownloadError

An error caused by downloading a file.

RequestError

An error caused by sending a request to Telegram.