Crate teloxide_core

source ·
Expand description

Core part of the teloxide library.

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

 teloxide_core = "0.9"

Compiler support: requires rustc 1.64+.

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

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

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
  • trace_adaptor — enables Trace bot adaptor
  • erased — enables ErasedRequester bot adaptor
  • throttle — enables Throttle bot adaptor
  • cache_me — enables CacheMe bot adaptor
  • full — enables all features except nightly and tls-related
  • nightly — enables nightly-only features, currently:
    • Removes some future boxing using #![feature(type_alias_impl_trait)]
    • Used to built docs (#![feature(doc_cfg, doc_notable_trait)])
  • auto_send — enables AutoSend bot adaptor (deprecated)

Re-exports

pub use self::errors::ApiError;
pub use self::errors::DownloadError;
pub use self::errors::RequestError;

Modules

Wrappers altering functionality of a bot.
Possible error types.
Network-specific API.
Request data sent to Telegram.
Commonly used items.
Telegram API requests.
Telegram API types.

Structs

A requests sender.