Methods
🦀 Telegram Bot API 9.4 · Fully Auto-Generated

The complete Rust
Telegram Bot library

tgbotrs gives you every Telegram Bot API method and type — fully typed, fully async, auto-generated from the official spec. Built with Tokio. Lowest supported: v0.1.4.

165Methods
257Types
9.4API Version
100%Async

🚀 Quick Start

Get your first bot running in under 2 minutes.

Step 1 — Get your bot token
Chat with @BotFather → /newbot → copy your token.
Step 2 — Cargo.toml
Cargo.toml
[dependencies]
tgbotrs = "0.1.4"
tokio   = { version = "1", features = ["full"] }
Step 3 — src/main.rs
src/main.rs
use tgbotrs::{Bot, Poller, UpdateHandler};

#[tokio::main]
async fn main() {
    let bot = Bot::new("YOUR_BOT_TOKEN").await.unwrap();
    let handler: UpdateHandler = Box::new(|bot, update| {
        Box::pin(async move {
            let Some(msg) = update.message else { return };
            let Some(text) = msg.text else { return };
            let reply = match text.as_str() {
                "/start" => "👋 Hello! Powered by tgbotrs 🦀".to_string(),
                other    => format!("Echo: {}", other),
            };
            let _ = bot.send_message(msg.chat.id, reply, None).await;
        })
    });
    Poller::new(bot, handler).timeout(30).start().await.unwrap();
}
Step 4 — Run
cargo run

📦 Installation

Minimum supported: v0.1.4

Standard (Long Polling)
Cargo.toml
[dependencies]
tgbotrs = "0.1.4"
tokio   = { version = "1", features = ["full"] }
With Webhook Feature
Cargo.toml
[dependencies]
tgbotrs = { version = "0.1.4", features = ["webhook"] }
tokio   = { version = "1", features = ["full"] }
Dependencies Included
✅ reqwest
✅ serde + serde_json
✅ tokio
✅ thiserror
🔌 axum (webhook only)
Env-based Token
src/main.rs
let token = std::env::var("BOT_TOKEN").expect("BOT_TOKEN not set");
let bot = Bot::new(token).await?;

✨ Features

Everything you need to build powerful Telegram bots in Rust.

Fully Async
Built on Tokio. Handle thousands of concurrent updates.
🔒
Strongly Typed
Every method, parameter and response is strongly typed. Compile-time safety.
🤖
Auto-Generated
All 165 methods and 257 types auto-generated from the official spec.
🏗️
Builder Pattern
Chain optional params like .parse_mode("HTML").
🪝
Built-in Webhook
Optional axum-based webhook server. One line to switch from polling.
📁
File Uploads
Upload by path, URL, or bytes. InputFile handles multipart transparently.
🎯
ChatId Flexibility
Pass IDs as i64, &str, or @username — all conversions automatic.
🎮
All Keyboard Types
InlineKeyboard, ReplyKeyboard, ForceReply — all four types supported.
🔧
Custom API Server
Use Bot::with_api_url() to point at your own server.

🔄 Long Polling

Simplest way to receive updates — no external server needed.

Polling with inline keyboard
use tgbotrs::{Bot, Poller, UpdateHandler};
use tgbotrs::gen_methods::{SendMessageParams, AnswerCallbackQueryParams};
use tgbotrs::types::{InlineKeyboardMarkup, InlineKeyboardButton};
use tgbotrs::ReplyMarkup;

#[tokio::main]
async fn main() {
    let bot = Bot::new("YOUR_BOT_TOKEN").await.unwrap();
    let handler: UpdateHandler = Box::new(|bot, update| {
        Box::pin(async move {
            if let Some(msg) = update.message {
                if msg.text.as_deref() == Some("/start") {
                    let keyboard = ReplyMarkup::InlineKeyboard(InlineKeyboardMarkup {
                        inline_keyboard: vec![vec![InlineKeyboardButton {
                            text: "🔵 Click me".into(),
                            callback_data: Some("btn1".into()),
                            ..Default::default()
                        }]]
                    });
                    let params = SendMessageParams::new().reply_markup(keyboard);
                    let _ = bot.send_message(msg.chat.id, "Pick a button 👇", Some(params)).await;
                }
            }
            if let Some(cq) = update.callback_query {
                let _ = bot.answer_callback_query(cq.id,
                    Some(AnswerCallbackQueryParams::new().text("Clicked! ✅".to_string()))
                ).await;
            }
        })
    });
    Poller::new(bot, handler).timeout(30).limit(100).start().await.unwrap();
}

🪝 Webhook Server

Production-ready webhook server powered by Axum.

Full webhook setup
use tgbotrs::{Bot, UpdateHandler, WebhookServer};

#[tokio::main]
async fn main() {
    let bot = Bot::new("YOUR_BOT_TOKEN").await.unwrap();
    let handler: UpdateHandler = Box::new(|bot, update| {
        Box::pin(async move {
            if let Some(msg) = update.message {
                let _ = bot.send_message(msg.chat.id, "pong! 🏓", None).await;
            }
        })
    });
    WebhookServer::new(bot, handler)
        .port(8080).path("/webhook")
        .secret_token("my_secret").max_connections(40)
        .start("https://yourdomain.com").await.unwrap();
}
Filter: 165 methods

Sending Messages

22
bot.send_animation()
async → Message +opts

Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound). On success, the sent Message is returned. Bots can currently send animation files of up to 50 MB in size, this limit may be changed in the future.

chat_idanimationparams
FieldTypeDescription
business_connection_idOption<String>Unique identifier of the business connection on behalf of which the message will be sent
message_thread_idOption<i64>Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only
direct_messages_topic_idOption<i64>Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat
durationOption<i64>Duration of sent animation in seconds
widthOption<i64>Animation width
heightOption<i64>Animation height
thumbnailOption<InputFileOrString>Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass "attach://<file_attach_name>" if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More information on Sending Files: https://core.telegram.org/bots/api#sending-files
captionOption<String>Animation caption (may also be used when resending animation by file_id), 0-1024 characters after entities parsing
parse_modeOption<String>Mode for parsing entities in the animation caption. See formatting options for more details.
caption_entitiesOption<Vec<MessageEntity>>A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode
show_caption_above_mediaOption<bool>Pass True, if the caption must be shown above the message media
has_spoilerOption<bool>Pass True if the animation needs to be covered with a spoiler animation
disable_notificationOption<bool>Sends the message silently. Users will receive a notification with no sound.
protect_contentOption<bool>Protects the contents of the sent message from forwarding and saving
allow_paid_broadcastOption<bool>Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance
message_effect_idOption<String>Unique identifier of the message effect to be added to the message; for private chats only
suggested_post_parametersOption<Box<SuggestedPostParameters>>A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined.
reply_parametersOption<Box<ReplyParameters>>Description of the message to reply to
reply_markupOption<ReplyMarkup>Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{SendAnimationParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let chat_id = 123456789i64;
    let animation = todo!();
    // Optional parameters
    let params = SendAnimationParams::new()
        .business_connection_id(None)
        .message_thread_id(None)
        .direct_messages_topic_id(None)
        .duration(None)
        .width(None)
        // ... +14 more optional fields;


    let result = bot.send_animation(
        chat_id,
        animation,
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.send_audio()
async → Message +opts

Use this method to send audio files, if you want Telegram clients to display them in the music player. Your audio must be in the .MP3 or .M4A format. On success, the sent Message is returned. Bots can currently send audio files of up to 50 MB in size, this limit may be changed in the future. /// For sending voice messages, use the sendVoice method instead.

chat_idaudioparams
FieldTypeDescription
business_connection_idOption<String>Unique identifier of the business connection on behalf of which the message will be sent
message_thread_idOption<i64>Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only
direct_messages_topic_idOption<i64>Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat
captionOption<String>Audio caption, 0-1024 characters after entities parsing
parse_modeOption<String>Mode for parsing entities in the audio caption. See formatting options for more details.
caption_entitiesOption<Vec<MessageEntity>>A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode
durationOption<i64>Duration of the audio in seconds
performerOption<String>Performer
titleOption<String>Track name
thumbnailOption<InputFileOrString>Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass "attach://<file_attach_name>" if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More information on Sending Files: https://core.telegram.org/bots/api#sending-files
disable_notificationOption<bool>Sends the message silently. Users will receive a notification with no sound.
protect_contentOption<bool>Protects the contents of the sent message from forwarding and saving
allow_paid_broadcastOption<bool>Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance
message_effect_idOption<String>Unique identifier of the message effect to be added to the message; for private chats only
suggested_post_parametersOption<Box<SuggestedPostParameters>>A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined.
reply_parametersOption<Box<ReplyParameters>>Description of the message to reply to
reply_markupOption<ReplyMarkup>Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{SendAudioParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let chat_id = 123456789i64;
    let audio = todo!();
    // Optional parameters
    let params = SendAudioParams::new()
        .business_connection_id(None)
        .message_thread_id(None)
        .direct_messages_topic_id(None)
        .caption(None)
        .parse_mode(None)
        // ... +12 more optional fields;


    let result = bot.send_audio(
        chat_id,
        audio,
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.send_chat_action()
async → bool +opts

Use this method when you need to tell the user that something is happening on the bot's side. The status is set for 5 seconds or less (when a message arrives from your bot, Telegram clients clear its typing status). Returns True on success. /// We only recommend using this method when a response from the bot will take a noticeable amount of time to arrive.

chat_idactionparams
FieldTypeDescription
business_connection_idOption<String>Unique identifier of the business connection on behalf of which the action will be sent
message_thread_idOption<i64>Unique identifier for the target message thread or topic of a forum; for supergroups and private chats of bots with forum topic mode enabled only
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{SendChatActionParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let chat_id = 123456789i64;
    let action = "example";
    // Optional parameters
    let params = SendChatActionParams::new()
        .business_connection_id(None)
        .message_thread_id(None);


    let result = bot.send_chat_action(
        chat_id,
        action,
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.send_checklist()
async → Message +opts

Use this method to send a checklist on behalf of a connected business account. On success, the sent Message is returned.

business_connection_idchat_idchecklistparams
FieldTypeDescription
disable_notificationOption<bool>Sends the message silently. Users will receive a notification with no sound.
protect_contentOption<bool>Protects the contents of the sent message from forwarding and saving
message_effect_idOption<String>Unique identifier of the message effect to be added to the message
reply_parametersOption<Box<ReplyParameters>>A JSON-serialized object for description of the message to reply to
reply_markupOption<Box<InlineKeyboardMarkup>>A JSON-serialized object for an inline keyboard
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{SendChecklistParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let business_connection_id = "example";
    let chat_id = 123456789i64;
    let checklist = InputChecklist::default();
    // Optional parameters
    let params = SendChecklistParams::new()
        .disable_notification(None)
        .protect_content(None)
        .message_effect_id(None)
        .reply_parameters(None)
        .reply_markup(None);


    let result = bot.send_checklist(
        business_connection_id,
        chat_id,
        checklist,
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.send_contact()
async → Message +opts

Use this method to send phone contacts. On success, the sent Message is returned.

chat_idphone_numberfirst_nameparams
FieldTypeDescription
business_connection_idOption<String>Unique identifier of the business connection on behalf of which the message will be sent
message_thread_idOption<i64>Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only
direct_messages_topic_idOption<i64>Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat
last_nameOption<String>Contact's last name
vcardOption<String>Additional data about the contact in the form of a vCard, 0-2048 bytes
disable_notificationOption<bool>Sends the message silently. Users will receive a notification with no sound.
protect_contentOption<bool>Protects the contents of the sent message from forwarding and saving
allow_paid_broadcastOption<bool>Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance
message_effect_idOption<String>Unique identifier of the message effect to be added to the message; for private chats only
suggested_post_parametersOption<Box<SuggestedPostParameters>>A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined.
reply_parametersOption<Box<ReplyParameters>>Description of the message to reply to
reply_markupOption<ReplyMarkup>Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{SendContactParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let chat_id = 123456789i64;
    let phone_number = "example";
    let first_name = "my_name";
    // Optional parameters
    let params = SendContactParams::new()
        .business_connection_id(None)
        .message_thread_id(None)
        .direct_messages_topic_id(None)
        .last_name(None)
        .vcard(None)
        // ... +7 more optional fields;


    let result = bot.send_contact(
        chat_id,
        phone_number,
        first_name,
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.send_dice()
async → Message +opts

Use this method to send an animated emoji that will display a random value. On success, the sent Message is returned.

chat_idparams
FieldTypeDescription
business_connection_idOption<String>Unique identifier of the business connection on behalf of which the message will be sent
message_thread_idOption<i64>Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only
direct_messages_topic_idOption<i64>Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat
emojiOption<String>Emoji on which the dice throw animation is based. Currently, must be one of "🎲", "🎯", "🏀", "⚽", "🎳", or "🎰". Dice can have values 1-6 for "🎲", "🎯" and "🎳", values 1-5 for "🏀" and "⚽", and values 1-64 for "🎰". Defaults to "🎲"
disable_notificationOption<bool>Sends the message silently. Users will receive a notification with no sound.
protect_contentOption<bool>Protects the contents of the sent message from forwarding
allow_paid_broadcastOption<bool>Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance
message_effect_idOption<String>Unique identifier of the message effect to be added to the message; for private chats only
suggested_post_parametersOption<Box<SuggestedPostParameters>>A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined.
reply_parametersOption<Box<ReplyParameters>>Description of the message to reply to
reply_markupOption<ReplyMarkup>Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{SendDiceParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let chat_id = 123456789i64;
    // Optional parameters
    let params = SendDiceParams::new()
        .business_connection_id(None)
        .message_thread_id(None)
        .direct_messages_topic_id(None)
        .emoji(None)
        .disable_notification(None)
        // ... +6 more optional fields;


    let result = bot.send_dice(
        chat_id,
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.send_document()
async → Message +opts

Use this method to send general files. On success, the sent Message is returned. Bots can currently send files of any type of up to 50 MB in size, this limit may be changed in the future.

chat_iddocumentparams
FieldTypeDescription
business_connection_idOption<String>Unique identifier of the business connection on behalf of which the message will be sent
message_thread_idOption<i64>Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only
direct_messages_topic_idOption<i64>Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat
thumbnailOption<InputFileOrString>Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass "attach://<file_attach_name>" if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More information on Sending Files: https://core.telegram.org/bots/api#sending-files
captionOption<String>Document caption (may also be used when resending documents by file_id), 0-1024 characters after entities parsing
parse_modeOption<String>Mode for parsing entities in the document caption. See formatting options for more details.
caption_entitiesOption<Vec<MessageEntity>>A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode
disable_content_type_detectionOption<bool>Disables automatic server-side content type detection for files uploaded using multipart/form-data
disable_notificationOption<bool>Sends the message silently. Users will receive a notification with no sound.
protect_contentOption<bool>Protects the contents of the sent message from forwarding and saving
allow_paid_broadcastOption<bool>Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance
message_effect_idOption<String>Unique identifier of the message effect to be added to the message; for private chats only
suggested_post_parametersOption<Box<SuggestedPostParameters>>A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined.
reply_parametersOption<Box<ReplyParameters>>Description of the message to reply to
reply_markupOption<ReplyMarkup>Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{SendDocumentParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let chat_id = 123456789i64;
    let document = todo!();
    // Optional parameters
    let params = SendDocumentParams::new()
        .business_connection_id(None)
        .message_thread_id(None)
        .direct_messages_topic_id(None)
        .thumbnail(None)
        .caption(None)
        // ... +10 more optional fields;


    let result = bot.send_document(
        chat_id,
        document,
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.send_game()
async → Message +opts

Use this method to send a game. On success, the sent Message is returned.

chat_idgame_short_nameparams
FieldTypeDescription
business_connection_idOption<String>Unique identifier of the business connection on behalf of which the message will be sent
message_thread_idOption<i64>Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only
disable_notificationOption<bool>Sends the message silently. Users will receive a notification with no sound.
protect_contentOption<bool>Protects the contents of the sent message from forwarding and saving
allow_paid_broadcastOption<bool>Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance
message_effect_idOption<String>Unique identifier of the message effect to be added to the message; for private chats only
reply_parametersOption<Box<ReplyParameters>>Description of the message to reply to
reply_markupOption<Box<InlineKeyboardMarkup>>A JSON-serialized object for an inline keyboard. If empty, one 'Play game_title' button will be shown. If not empty, the first button must launch the game.
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{SendGameParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let chat_id = 123456789i64;
    let game_short_name = "my_name";
    // Optional parameters
    let params = SendGameParams::new()
        .business_connection_id(None)
        .message_thread_id(None)
        .disable_notification(None)
        .protect_content(None)
        .allow_paid_broadcast(None)
        // ... +3 more optional fields;


    let result = bot.send_game(
        chat_id,
        game_short_name,
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.send_gift()
async → bool +opts

Sends a gift to the given user or channel chat. The gift can't be converted to Telegram Stars by the receiver. Returns True on success.

gift_idparams
FieldTypeDescription
user_idOption<i64>Required if chat_id is not specified. Unique identifier of the target user who will receive the gift.
chat_idOption<ChatId>Required if user_id is not specified. Unique identifier for the chat or username of the channel (in the format @channelusername) that will receive the gift.
pay_for_upgradeOption<bool>Pass True to pay for the gift upgrade from the bot's balance, thereby making the upgrade free for the receiver
textOption<String>Text that will be shown along with the gift; 0-128 characters
text_parse_modeOption<String>Mode for parsing entities in the text. See formatting options for more details. Entities other than "bold", "italic", "underline", "strikethrough", "spoiler", and "custom_emoji" are ignored.
text_entitiesOption<Vec<MessageEntity>>A JSON-serialized list of special entities that appear in the gift text. It can be specified instead of text_parse_mode. Entities other than "bold", "italic", "underline", "strikethrough", "spoiler", and "custom_emoji" are ignored.
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{SendGiftParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let gift_id = "example";
    // Optional parameters
    let params = SendGiftParams::new()
        .user_id(None)
        .chat_id(None)
        .pay_for_upgrade(None)
        .text(None)
        .text_parse_mode(None)
        // ... +1 more optional fields;


    let result = bot.send_gift(
        gift_id,
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.send_invoice()
async → Message +opts

Use this method to send invoices. On success, the sent Message is returned.

chat_idtitledescriptionpayloadcurrencypricesparams
FieldTypeDescription
message_thread_idOption<i64>Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only
direct_messages_topic_idOption<i64>Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat
provider_tokenOption<String>Payment provider token, obtained via @BotFather. Pass an empty string for payments in Telegram Stars.
max_tip_amountOption<i64>The maximum accepted amount for tips in the smallest units of the currency (integer, not float/double). For example, for a maximum tip of US$ 1.45 pass max_tip_amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). Defaults to 0. Not supported for payments in Telegram Stars.
suggested_tip_amountsOption<Vec<i64>>A JSON-serialized array of suggested amounts of tips in the smallest units of the currency (integer, not float/double). At most 4 suggested tip amounts can be specified. The suggested tip amounts must be positive, passed in a strictly increased order and must not exceed max_tip_amount.
start_parameterOption<String>Unique deep-linking parameter. If left empty, forwarded copies of the sent message will have a Pay button, allowing multiple users to pay directly from the forwarded message, using the same invoice. If non-empty, forwarded copies of the sent message will have a URL button with a deep link to the bot (instead of a Pay button), with the value used as the start parameter
provider_dataOption<String>JSON-serialized data about the invoice, which will be shared with the payment provider. A detailed description of required fields should be provided by the payment provider.
photo_urlOption<String>URL of the product photo for the invoice. Can be a photo of the goods or a marketing image for a service. People like it better when they see what they are paying for.
photo_sizeOption<i64>Photo size in bytes
photo_widthOption<i64>Photo width
photo_heightOption<i64>Photo height
need_nameOption<bool>Pass True if you require the user's full name to complete the order. Ignored for payments in Telegram Stars.
need_phone_numberOption<bool>Pass True if you require the user's phone number to complete the order. Ignored for payments in Telegram Stars.
need_emailOption<bool>Pass True if you require the user's email address to complete the order. Ignored for payments in Telegram Stars.
need_shipping_addressOption<bool>Pass True if you require the user's shipping address to complete the order. Ignored for payments in Telegram Stars.
send_phone_number_to_providerOption<bool>Pass True if the user's phone number should be sent to the provider. Ignored for payments in Telegram Stars.
send_email_to_providerOption<bool>Pass True if the user's email address should be sent to the provider. Ignored for payments in Telegram Stars.
is_flexibleOption<bool>Pass True if the final price depends on the shipping method. Ignored for payments in Telegram Stars.
disable_notificationOption<bool>Sends the message silently. Users will receive a notification with no sound.
protect_contentOption<bool>Protects the contents of the sent message from forwarding and saving
allow_paid_broadcastOption<bool>Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance
message_effect_idOption<String>Unique identifier of the message effect to be added to the message; for private chats only
suggested_post_parametersOption<Box<SuggestedPostParameters>>A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined.
reply_parametersOption<Box<ReplyParameters>>Description of the message to reply to
reply_markupOption<Box<InlineKeyboardMarkup>>A JSON-serialized object for an inline keyboard. If empty, one 'Pay total price' button will be shown. If not empty, the first button must be a Pay button.
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{SendInvoiceParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let chat_id = 123456789i64;
    let title = "example";
    let description = "example";
    let payload = "example";
    let currency = "example";
    let prices = vec![]  // Vec<LabeledPrice>;
    // Optional parameters
    let params = SendInvoiceParams::new()
        .message_thread_id(None)
        .direct_messages_topic_id(None)
        .provider_token(None)
        .max_tip_amount(None)
        .suggested_tip_amounts(None)
        // ... +20 more optional fields;


    let result = bot.send_invoice(
        chat_id,
        title,
        description,
        payload,
        currency,
        prices,
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.send_location()
async → Message +opts

Use this method to send point on the map. On success, the sent Message is returned.

chat_idlatitudelongitudeparams
FieldTypeDescription
business_connection_idOption<String>Unique identifier of the business connection on behalf of which the message will be sent
message_thread_idOption<i64>Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only
direct_messages_topic_idOption<i64>Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat
horizontal_accuracyOption<f64>The radius of uncertainty for the location, measured in meters; 0-1500
live_periodOption<i64>Period in seconds during which the location will be updated (see Live Locations, should be between 60 and 86400, or 0x7FFFFFFF for live locations that can be edited indefinitely.
headingOption<i64>For live locations, a direction in which the user is moving, in degrees. Must be between 1 and 360 if specified.
proximity_alert_radiusOption<i64>For live locations, a maximum distance for proximity alerts about approaching another chat member, in meters. Must be between 1 and 100000 if specified.
disable_notificationOption<bool>Sends the message silently. Users will receive a notification with no sound.
protect_contentOption<bool>Protects the contents of the sent message from forwarding and saving
allow_paid_broadcastOption<bool>Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance
message_effect_idOption<String>Unique identifier of the message effect to be added to the message; for private chats only
suggested_post_parametersOption<Box<SuggestedPostParameters>>A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined.
reply_parametersOption<Box<ReplyParameters>>Description of the message to reply to
reply_markupOption<ReplyMarkup>Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{SendLocationParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let chat_id = 123456789i64;
    let latitude = 0.0;
    let longitude = 0.0;
    // Optional parameters
    let params = SendLocationParams::new()
        .business_connection_id(None)
        .message_thread_id(None)
        .direct_messages_topic_id(None)
        .horizontal_accuracy(None)
        .live_period(None)
        // ... +9 more optional fields;


    let result = bot.send_location(
        chat_id,
        latitude,
        longitude,
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.send_media_group()
async → Vec<Message> +opts

Use this method to send a group of photos, videos, documents or audios as an album. Documents and audio files can be only grouped in an album with messages of the same type. On success, an array of Message objects that were sent is returned.

chat_idmediaparams
FieldTypeDescription
business_connection_idOption<String>Unique identifier of the business connection on behalf of which the message will be sent
message_thread_idOption<i64>Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only
direct_messages_topic_idOption<i64>Identifier of the direct messages topic to which the messages will be sent; required if the messages are sent to a direct messages chat
disable_notificationOption<bool>Sends messages silently. Users will receive a notification with no sound.
protect_contentOption<bool>Protects the contents of the sent messages from forwarding and saving
allow_paid_broadcastOption<bool>Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance
message_effect_idOption<String>Unique identifier of the message effect to be added to the message; for private chats only
reply_parametersOption<Box<ReplyParameters>>Description of the message to reply to
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{SendMediaGroupParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let chat_id = 123456789i64;
    let media = todo!();
    // Optional parameters
    let params = SendMediaGroupParams::new()
        .business_connection_id(None)
        .message_thread_id(None)
        .direct_messages_topic_id(None)
        .disable_notification(None)
        .protect_content(None)
        // ... +3 more optional fields;


    let result = bot.send_media_group(
        chat_id,
        media,
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.send_message()
async → Message +opts

Use this method to send text messages. On success, the sent Message is returned.

chat_idtextparams
FieldTypeDescription
business_connection_idOption<String>Unique identifier of the business connection on behalf of which the message will be sent
message_thread_idOption<i64>Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only
direct_messages_topic_idOption<i64>Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat
parse_modeOption<String>Mode for parsing entities in the message text. See formatting options for more details.
entitiesOption<Vec<MessageEntity>>A JSON-serialized list of special entities that appear in message text, which can be specified instead of parse_mode
link_preview_optionsOption<Box<LinkPreviewOptions>>Link preview generation options for the message
disable_notificationOption<bool>Sends the message silently. Users will receive a notification with no sound.
protect_contentOption<bool>Protects the contents of the sent message from forwarding and saving
allow_paid_broadcastOption<bool>Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance
message_effect_idOption<String>Unique identifier of the message effect to be added to the message; for private chats only
suggested_post_parametersOption<Box<SuggestedPostParameters>>A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined.
reply_parametersOption<Box<ReplyParameters>>Description of the message to reply to
reply_markupOption<ReplyMarkup>Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{SendMessageParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let chat_id = 123456789i64;
    let text = "Hello from tgbotrs! 🦀";
    // Optional parameters
    let params = SendMessageParams::new()
        .business_connection_id(None)
        .message_thread_id(None)
        .direct_messages_topic_id(None)
        .parse_mode(None)
        .entities(None)
        // ... +8 more optional fields;


    let result = bot.send_message(
        chat_id,
        text,
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.send_message_draft()
async → bool +opts

Use this method to stream a partial message to a user while the message is being generated; supported only for bots with forum topic mode enabled. Returns True on success.

chat_iddraft_idtextparams
FieldTypeDescription
message_thread_idOption<i64>Unique identifier for the target message thread
parse_modeOption<String>Mode for parsing entities in the message text. See formatting options for more details.
entitiesOption<Vec<MessageEntity>>A JSON-serialized list of special entities that appear in message text, which can be specified instead of parse_mode
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{SendMessageDraftParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let chat_id = 123456789i64;
    let draft_id = 0i64;
    let text = "Hello from tgbotrs! 🦀";
    // Optional parameters
    let params = SendMessageDraftParams::new()
        .message_thread_id(None)
        .parse_mode(None)
        .entities(None);


    let result = bot.send_message_draft(
        chat_id,
        draft_id,
        text,
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.send_paid_media()
async → Message +opts

Use this method to send paid media. On success, the sent Message is returned.

chat_idstar_countmediaparams
FieldTypeDescription
business_connection_idOption<String>Unique identifier of the business connection on behalf of which the message will be sent
message_thread_idOption<i64>Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only
direct_messages_topic_idOption<i64>Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat
payloadOption<String>Bot-defined paid media payload, 0-128 bytes. This will not be displayed to the user, use it for your internal processes.
captionOption<String>Media caption, 0-1024 characters after entities parsing
parse_modeOption<String>Mode for parsing entities in the media caption. See formatting options for more details.
caption_entitiesOption<Vec<MessageEntity>>A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode
show_caption_above_mediaOption<bool>Pass True, if the caption must be shown above the message media
disable_notificationOption<bool>Sends the message silently. Users will receive a notification with no sound.
protect_contentOption<bool>Protects the contents of the sent message from forwarding and saving
allow_paid_broadcastOption<bool>Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance
suggested_post_parametersOption<Box<SuggestedPostParameters>>A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined.
reply_parametersOption<Box<ReplyParameters>>Description of the message to reply to
reply_markupOption<ReplyMarkup>Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{SendPaidMediaParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let chat_id = 123456789i64;
    let star_count = 0i64;
    let media = vec![]  // Vec<InputPaidMedia>;
    // Optional parameters
    let params = SendPaidMediaParams::new()
        .business_connection_id(None)
        .message_thread_id(None)
        .direct_messages_topic_id(None)
        .payload(None)
        .caption(None)
        // ... +9 more optional fields;


    let result = bot.send_paid_media(
        chat_id,
        star_count,
        media,
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.send_photo()
async → Message +opts

Use this method to send photos. On success, the sent Message is returned.

chat_idphotoparams
FieldTypeDescription
business_connection_idOption<String>Unique identifier of the business connection on behalf of which the message will be sent
message_thread_idOption<i64>Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only
direct_messages_topic_idOption<i64>Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat
captionOption<String>Photo caption (may also be used when resending photos by file_id), 0-1024 characters after entities parsing
parse_modeOption<String>Mode for parsing entities in the photo caption. See formatting options for more details.
caption_entitiesOption<Vec<MessageEntity>>A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode
show_caption_above_mediaOption<bool>Pass True, if the caption must be shown above the message media
has_spoilerOption<bool>Pass True if the photo needs to be covered with a spoiler animation
disable_notificationOption<bool>Sends the message silently. Users will receive a notification with no sound.
protect_contentOption<bool>Protects the contents of the sent message from forwarding and saving
allow_paid_broadcastOption<bool>Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance
message_effect_idOption<String>Unique identifier of the message effect to be added to the message; for private chats only
suggested_post_parametersOption<Box<SuggestedPostParameters>>A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined.
reply_parametersOption<Box<ReplyParameters>>Description of the message to reply to
reply_markupOption<ReplyMarkup>Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{SendPhotoParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let chat_id = 123456789i64;
    let photo = todo!();
    // Optional parameters
    let params = SendPhotoParams::new()
        .business_connection_id(None)
        .message_thread_id(None)
        .direct_messages_topic_id(None)
        .caption(None)
        .parse_mode(None)
        // ... +10 more optional fields;


    let result = bot.send_photo(
        chat_id,
        photo,
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.send_poll()
async → Message +opts

Use this method to send a native poll. On success, the sent Message is returned.

chat_idquestionoptionsparams
FieldTypeDescription
business_connection_idOption<String>Unique identifier of the business connection on behalf of which the message will be sent
message_thread_idOption<i64>Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only
question_parse_modeOption<String>Mode for parsing entities in the question. See formatting options for more details. Currently, only custom emoji entities are allowed
question_entitiesOption<Vec<MessageEntity>>A JSON-serialized list of special entities that appear in the poll question. It can be specified instead of question_parse_mode
is_anonymousOption<bool>True, if the poll needs to be anonymous, defaults to True
allows_multiple_answersOption<bool>True, if the poll allows multiple answers, ignored for polls in quiz mode, defaults to False
correct_option_idOption<i64>0-based identifier of the correct answer option, required for polls in quiz mode
explanationOption<String>Text that is shown when a user chooses an incorrect answer or taps on the lamp icon in a quiz-style poll, 0-200 characters with at most 2 line feeds after entities parsing
explanation_parse_modeOption<String>Mode for parsing entities in the explanation. See formatting options for more details.
explanation_entitiesOption<Vec<MessageEntity>>A JSON-serialized list of special entities that appear in the poll explanation. It can be specified instead of explanation_parse_mode
open_periodOption<i64>Amount of time in seconds the poll will be active after creation, 5-600. Can't be used together with close_date.
close_dateOption<i64>Point in time (Unix timestamp) when the poll will be automatically closed. Must be at least 5 and no more than 600 seconds in the future. Can't be used together with open_period.
is_closedOption<bool>Pass True if the poll needs to be immediately closed. This can be useful for poll preview.
disable_notificationOption<bool>Sends the message silently. Users will receive a notification with no sound.
protect_contentOption<bool>Protects the contents of the sent message from forwarding and saving
allow_paid_broadcastOption<bool>Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance
message_effect_idOption<String>Unique identifier of the message effect to be added to the message; for private chats only
reply_parametersOption<Box<ReplyParameters>>Description of the message to reply to
reply_markupOption<ReplyMarkup>Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{SendPollParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let chat_id = 123456789i64;
    let question = "example";
    let options = vec![]  // Vec<InputPollOption>;
    // Optional parameters
    let params = SendPollParams::new()
        .business_connection_id(None)
        .message_thread_id(None)
        .question_parse_mode(None)
        .question_entities(None)
        .is_anonymous(None)
        // ... +14 more optional fields;


    let result = bot.send_poll(
        chat_id,
        question,
        options,
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.send_sticker()
async → Message +opts

Use this method to send static .WEBP, animated .TGS, or video .WEBM stickers. On success, the sent Message is returned.

chat_idstickerparams
FieldTypeDescription
business_connection_idOption<String>Unique identifier of the business connection on behalf of which the message will be sent
message_thread_idOption<i64>Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only
direct_messages_topic_idOption<i64>Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat
emojiOption<String>Emoji associated with the sticker; only for just uploaded stickers
disable_notificationOption<bool>Sends the message silently. Users will receive a notification with no sound.
protect_contentOption<bool>Protects the contents of the sent message from forwarding and saving
allow_paid_broadcastOption<bool>Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance
message_effect_idOption<String>Unique identifier of the message effect to be added to the message; for private chats only
suggested_post_parametersOption<Box<SuggestedPostParameters>>A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined.
reply_parametersOption<Box<ReplyParameters>>Description of the message to reply to
reply_markupOption<ReplyMarkup>Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{SendStickerParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let chat_id = 123456789i64;
    let sticker = todo!();
    // Optional parameters
    let params = SendStickerParams::new()
        .business_connection_id(None)
        .message_thread_id(None)
        .direct_messages_topic_id(None)
        .emoji(None)
        .disable_notification(None)
        // ... +6 more optional fields;


    let result = bot.send_sticker(
        chat_id,
        sticker,
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.send_venue()
async → Message +opts

Use this method to send information about a venue. On success, the sent Message is returned.

chat_idlatitudelongitudetitleaddressparams
FieldTypeDescription
business_connection_idOption<String>Unique identifier of the business connection on behalf of which the message will be sent
message_thread_idOption<i64>Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only
direct_messages_topic_idOption<i64>Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat
foursquare_idOption<String>Foursquare identifier of the venue
foursquare_typeOption<String>Foursquare type of the venue, if known. (For example, "arts_entertainment/default", "arts_entertainment/aquarium" or "food/icecream".)
google_place_idOption<String>Google Places identifier of the venue
google_place_typeOption<String>Google Places type of the venue. (See supported types.)
disable_notificationOption<bool>Sends the message silently. Users will receive a notification with no sound.
protect_contentOption<bool>Protects the contents of the sent message from forwarding and saving
allow_paid_broadcastOption<bool>Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance
message_effect_idOption<String>Unique identifier of the message effect to be added to the message; for private chats only
suggested_post_parametersOption<Box<SuggestedPostParameters>>A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined.
reply_parametersOption<Box<ReplyParameters>>Description of the message to reply to
reply_markupOption<ReplyMarkup>Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{SendVenueParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let chat_id = 123456789i64;
    let latitude = 0.0;
    let longitude = 0.0;
    let title = "example";
    let address = "example";
    // Optional parameters
    let params = SendVenueParams::new()
        .business_connection_id(None)
        .message_thread_id(None)
        .direct_messages_topic_id(None)
        .foursquare_id(None)
        .foursquare_type(None)
        // ... +9 more optional fields;


    let result = bot.send_venue(
        chat_id,
        latitude,
        longitude,
        title,
        address,
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.send_video()
async → Message +opts

Use this method to send video files, Telegram clients support MPEG4 videos (other formats may be sent as Document). On success, the sent Message is returned. Bots can currently send video files of up to 50 MB in size, this limit may be changed in the future.

chat_idvideoparams
FieldTypeDescription
business_connection_idOption<String>Unique identifier of the business connection on behalf of which the message will be sent
message_thread_idOption<i64>Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only
direct_messages_topic_idOption<i64>Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat
durationOption<i64>Duration of sent video in seconds
widthOption<i64>Video width
heightOption<i64>Video height
thumbnailOption<InputFileOrString>Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass "attach://<file_attach_name>" if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More information on Sending Files: https://core.telegram.org/bots/api#sending-files
coverOption<InputFileOrString>Cover for the video in the message. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass "attach://<file_attach_name>" to upload a new one using multipart/form-data under <file_attach_name> name. More information on Sending Files: https://core.telegram.org/bots/api#sending-files
start_timestampOption<i64>Start timestamp for the video in the message
captionOption<String>Video caption (may also be used when resending videos by file_id), 0-1024 characters after entities parsing
parse_modeOption<String>Mode for parsing entities in the video caption. See formatting options for more details.
caption_entitiesOption<Vec<MessageEntity>>A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode
show_caption_above_mediaOption<bool>Pass True, if the caption must be shown above the message media
has_spoilerOption<bool>Pass True if the video needs to be covered with a spoiler animation
supports_streamingOption<bool>Pass True if the uploaded video is suitable for streaming
disable_notificationOption<bool>Sends the message silently. Users will receive a notification with no sound.
protect_contentOption<bool>Protects the contents of the sent message from forwarding and saving
allow_paid_broadcastOption<bool>Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance
message_effect_idOption<String>Unique identifier of the message effect to be added to the message; for private chats only
suggested_post_parametersOption<Box<SuggestedPostParameters>>A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined.
reply_parametersOption<Box<ReplyParameters>>Description of the message to reply to
reply_markupOption<ReplyMarkup>Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{SendVideoParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let chat_id = 123456789i64;
    let video = todo!();
    // Optional parameters
    let params = SendVideoParams::new()
        .business_connection_id(None)
        .message_thread_id(None)
        .direct_messages_topic_id(None)
        .duration(None)
        .width(None)
        // ... +17 more optional fields;


    let result = bot.send_video(
        chat_id,
        video,
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.send_video_note()
async → Message +opts

As of v.4.0, Telegram clients support rounded square MPEG4 videos of up to 1 minute long. Use this method to send video messages. On success, the sent Message is returned.

chat_idvideo_noteparams
FieldTypeDescription
business_connection_idOption<String>Unique identifier of the business connection on behalf of which the message will be sent
message_thread_idOption<i64>Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only
direct_messages_topic_idOption<i64>Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat
durationOption<i64>Duration of sent video in seconds
lengthOption<i64>Video width and height, i.e. diameter of the video message
thumbnailOption<InputFileOrString>Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass "attach://<file_attach_name>" if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More information on Sending Files: https://core.telegram.org/bots/api#sending-files
disable_notificationOption<bool>Sends the message silently. Users will receive a notification with no sound.
protect_contentOption<bool>Protects the contents of the sent message from forwarding and saving
allow_paid_broadcastOption<bool>Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance
message_effect_idOption<String>Unique identifier of the message effect to be added to the message; for private chats only
suggested_post_parametersOption<Box<SuggestedPostParameters>>A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined.
reply_parametersOption<Box<ReplyParameters>>Description of the message to reply to
reply_markupOption<ReplyMarkup>Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{SendVideoNoteParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let chat_id = 123456789i64;
    let video_note = todo!();
    // Optional parameters
    let params = SendVideoNoteParams::new()
        .business_connection_id(None)
        .message_thread_id(None)
        .direct_messages_topic_id(None)
        .duration(None)
        .length(None)
        // ... +8 more optional fields;


    let result = bot.send_video_note(
        chat_id,
        video_note,
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.send_voice()
async → Message +opts

Use this method to send audio files, if you want Telegram clients to display the file as a playable voice message. For this to work, your audio must be in an .OGG file encoded with OPUS, or in .MP3 format, or in .M4A format (other formats may be sent as Audio or Document). On success, the sent Message is returned. Bots can currently send voice messages of up to 50 MB in size, this limit may be changed in the future.

chat_idvoiceparams
FieldTypeDescription
business_connection_idOption<String>Unique identifier of the business connection on behalf of which the message will be sent
message_thread_idOption<i64>Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only
direct_messages_topic_idOption<i64>Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat
captionOption<String>Voice message caption, 0-1024 characters after entities parsing
parse_modeOption<String>Mode for parsing entities in the voice message caption. See formatting options for more details.
caption_entitiesOption<Vec<MessageEntity>>A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode
durationOption<i64>Duration of the voice message in seconds
disable_notificationOption<bool>Sends the message silently. Users will receive a notification with no sound.
protect_contentOption<bool>Protects the contents of the sent message from forwarding and saving
allow_paid_broadcastOption<bool>Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance
message_effect_idOption<String>Unique identifier of the message effect to be added to the message; for private chats only
suggested_post_parametersOption<Box<SuggestedPostParameters>>A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined.
reply_parametersOption<Box<ReplyParameters>>Description of the message to reply to
reply_markupOption<ReplyMarkup>Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{SendVoiceParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let chat_id = 123456789i64;
    let voice = todo!();
    // Optional parameters
    let params = SendVoiceParams::new()
        .business_connection_id(None)
        .message_thread_id(None)
        .direct_messages_topic_id(None)
        .caption(None)
        .parse_mode(None)
        // ... +9 more optional fields;


    let result = bot.send_voice(
        chat_id,
        voice,
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}

Getting Info

29
bot.get_available_gifts()
async → Gifts

Returns the list of gifts that can be sent by the bot to users and channel chats. Requires no parameters. Returns a Gifts object.

no parameters
🔗
use tgbotrs::{Bot, BotError};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;


    let result = bot.get_available_gifts().await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.get_business_account_gifts()
async → OwnedGifts +opts

Returns the gifts received and owned by a managed business account. Requires the can_view_gifts_and_stars business bot right. Returns OwnedGifts on success.

business_connection_idparams
FieldTypeDescription
exclude_unsavedOption<bool>Pass True to exclude gifts that aren't saved to the account's profile page
exclude_savedOption<bool>Pass True to exclude gifts that are saved to the account's profile page
exclude_unlimitedOption<bool>Pass True to exclude gifts that can be purchased an unlimited number of times
exclude_limited_upgradableOption<bool>Pass True to exclude gifts that can be purchased a limited number of times and can be upgraded to unique
exclude_limited_non_upgradableOption<bool>Pass True to exclude gifts that can be purchased a limited number of times and can't be upgraded to unique
exclude_uniqueOption<bool>Pass True to exclude unique gifts
exclude_from_blockchainOption<bool>Pass True to exclude gifts that were assigned from the TON blockchain and can't be resold or transferred in Telegram
sort_by_priceOption<bool>Pass True to sort results by gift price instead of send date. Sorting is applied before pagination.
offsetOption<String>Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results
limitOption<i64>The maximum number of gifts to be returned; 1-100. Defaults to 100
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{GetBusinessAccountGiftsParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let business_connection_id = "example";
    // Optional parameters
    let params = GetBusinessAccountGiftsParams::new()
        .exclude_unsaved(None)
        .exclude_saved(None)
        .exclude_unlimited(None)
        .exclude_limited_upgradable(None)
        .exclude_limited_non_upgradable(None)
        // ... +5 more optional fields;


    let result = bot.get_business_account_gifts(
        business_connection_id,
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.get_business_account_star_balance()
async → StarAmount

Returns the amount of Telegram Stars owned by a managed business account. Requires the can_view_gifts_and_stars business bot right. Returns StarAmount on success.

business_connection_id
🔗
use tgbotrs::{Bot, BotError};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let business_connection_id = "example";

    let result = bot.get_business_account_star_balance(
        business_connection_id
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.get_business_connection()
async → BusinessConnection

Use this method to get information about the connection of the bot with a business account. Returns a BusinessConnection object on success.

business_connection_id
🔗
use tgbotrs::{Bot, BotError};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let business_connection_id = "example";

    let result = bot.get_business_connection(
        business_connection_id
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.get_chat()
async → ChatFullInfo

Use this method to get up-to-date information about the chat. Returns a ChatFullInfo object on success.

chat_id
🔗
use tgbotrs::{Bot, BotError};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let chat_id = 123456789i64;

    let result = bot.get_chat(
        chat_id
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.get_chat_administrators()
async → Vec<ChatMember>

Use this method to get a list of administrators in a chat, which aren't bots. Returns an Array of ChatMember objects.

chat_id
🔗
use tgbotrs::{Bot, BotError};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let chat_id = 123456789i64;

    let result = bot.get_chat_administrators(
        chat_id
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.get_chat_gifts()
async → OwnedGifts +opts

Returns the gifts owned by a chat. Returns OwnedGifts on success.

chat_idparams
FieldTypeDescription
exclude_unsavedOption<bool>Pass True to exclude gifts that aren't saved to the chat's profile page. Always True, unless the bot has the can_post_messages administrator right in the channel.
exclude_savedOption<bool>Pass True to exclude gifts that are saved to the chat's profile page. Always False, unless the bot has the can_post_messages administrator right in the channel.
exclude_unlimitedOption<bool>Pass True to exclude gifts that can be purchased an unlimited number of times
exclude_limited_upgradableOption<bool>Pass True to exclude gifts that can be purchased a limited number of times and can be upgraded to unique
exclude_limited_non_upgradableOption<bool>Pass True to exclude gifts that can be purchased a limited number of times and can't be upgraded to unique
exclude_from_blockchainOption<bool>Pass True to exclude gifts that were assigned from the TON blockchain and can't be resold or transferred in Telegram
exclude_uniqueOption<bool>Pass True to exclude unique gifts
sort_by_priceOption<bool>Pass True to sort results by gift price instead of send date. Sorting is applied before pagination.
offsetOption<String>Offset of the first entry to return as received from the previous request; use an empty string to get the first chunk of results
limitOption<i64>The maximum number of gifts to be returned; 1-100. Defaults to 100
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{GetChatGiftsParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let chat_id = 123456789i64;
    // Optional parameters
    let params = GetChatGiftsParams::new()
        .exclude_unsaved(None)
        .exclude_saved(None)
        .exclude_unlimited(None)
        .exclude_limited_upgradable(None)
        .exclude_limited_non_upgradable(None)
        // ... +5 more optional fields;


    let result = bot.get_chat_gifts(
        chat_id,
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.get_chat_member()
async → ChatMember

Use this method to get information about a member of a chat. The method is only guaranteed to work for other users if the bot is an administrator in the chat. Returns a ChatMember object on success.

chat_iduser_id
🔗
use tgbotrs::{Bot, BotError};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let chat_id = 123456789i64;
    let user_id = 123456789i64;

    let result = bot.get_chat_member(
        chat_id,
        user_id
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.get_chat_member_count()
async → i64

Use this method to get the number of members in a chat. Returns Int on success.

chat_id
🔗
use tgbotrs::{Bot, BotError};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let chat_id = 123456789i64;

    let result = bot.get_chat_member_count(
        chat_id
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.get_chat_menu_button()
async → MenuButton +opts

Use this method to get the current value of the bot's menu button in a private chat, or the default menu button. Returns MenuButton on success.

params
FieldTypeDescription
chat_idOption<i64>Unique identifier for the target private chat. If not specified, default bot's menu button will be returned
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{GetChatMenuButtonParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    // Optional parameters
    let params = GetChatMenuButtonParams::new()
        .chat_id(None);


    let result = bot.get_chat_menu_button(
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.get_custom_emoji_stickers()
async → Vec<Sticker>

Use this method to get information about custom emoji stickers by their identifiers. Returns an Array of Sticker objects.

custom_emoji_ids
🔗
use tgbotrs::{Bot, BotError};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let custom_emoji_ids = vec![]  // Vec<String>;

    let result = bot.get_custom_emoji_stickers(
        custom_emoji_ids
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.get_file()
async → File

Use this method to get basic information about a file and prepare it for downloading. For the moment, bots can download files of up to 20MB in size. On success, a File object is returned. The file can then be downloaded via the link https://api.telegram.org/file/bot<token>/<file_path>, where <file_path> is taken from the response. It is guaranteed that the link will be valid for at least 1 hour. When the link expires, a new one can be requested by calling getFile again. /// Note: This function may not preserve the original file name and MIME type. You should save the file's MIME type and name (if available) when the File object is received.

file_id
🔗
use tgbotrs::{Bot, BotError};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let file_id = "example";

    let result = bot.get_file(
        file_id
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.get_forum_topic_icon_stickers()
async → Vec<Sticker>

Use this method to get custom emoji stickers, which can be used as a forum topic icon by any user. Requires no parameters. Returns an Array of Sticker objects.

no parameters
🔗
use tgbotrs::{Bot, BotError};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;


    let result = bot.get_forum_topic_icon_stickers().await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.get_game_high_scores()
async → Vec<GameHighScore> +opts

Use this method to get data for high score tables. Will return the score of the specified user and several of their neighbors in a game. Returns an Array of GameHighScore objects.

user_idparams
FieldTypeDescription
chat_idOption<i64>Required if inline_message_id is not specified. Unique identifier for the target chat
message_idOption<i64>Required if inline_message_id is not specified. Identifier of the sent message
inline_message_idOption<String>Required if chat_id and message_id are not specified. Identifier of the inline message
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{GetGameHighScoresParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let user_id = 123456789i64;
    // Optional parameters
    let params = GetGameHighScoresParams::new()
        .chat_id(None)
        .message_id(None)
        .inline_message_id(None);


    let result = bot.get_game_high_scores(
        user_id,
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.get_me()
async → User

A simple method for testing your bot's authentication token. Requires no parameters. Returns basic information about the bot in form of a User object.

no parameters
🔗
use tgbotrs::{Bot, BotError};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;


    let result = bot.get_me().await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.get_my_commands()
async → Vec<BotCommand> +opts

Use this method to get the current list of the bot's commands for the given scope and user language. Returns an Array of BotCommand objects. If commands aren't set, an empty list is returned.

params
FieldTypeDescription
scopeOption<Box<BotCommandScope>>A JSON-serialized object, describing scope of users. Defaults to BotCommandScopeDefault.
language_codeOption<String>A two-letter ISO 639-1 language code or an empty string
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{GetMyCommandsParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    // Optional parameters
    let params = GetMyCommandsParams::new()
        .scope(None)
        .language_code(None);


    let result = bot.get_my_commands(
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.get_my_default_administrator_rights()
async → ChatAdministratorRights +opts

Use this method to get the current default administrator rights of the bot. Returns ChatAdministratorRights on success.

params
FieldTypeDescription
for_channelsOption<bool>Pass True to get default administrator rights of the bot in channels. Otherwise, default administrator rights of the bot for groups and supergroups will be returned.
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{GetMyDefaultAdministratorRightsParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    // Optional parameters
    let params = GetMyDefaultAdministratorRightsParams::new()
        .for_channels(None);


    let result = bot.get_my_default_administrator_rights(
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.get_my_description()
async → BotDescription +opts

Use this method to get the current bot description for the given user language. Returns BotDescription on success.

params
FieldTypeDescription
language_codeOption<String>A two-letter ISO 639-1 language code or an empty string
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{GetMyDescriptionParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    // Optional parameters
    let params = GetMyDescriptionParams::new()
        .language_code(None);


    let result = bot.get_my_description(
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.get_my_name()
async → BotName +opts

Use this method to get the current bot name for the given user language. Returns BotName on success.

params
FieldTypeDescription
language_codeOption<String>A two-letter ISO 639-1 language code or an empty string
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{GetMyNameParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    // Optional parameters
    let params = GetMyNameParams::new()
        .language_code(None);


    let result = bot.get_my_name(
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.get_my_short_description()
async → BotShortDescription +opts

Use this method to get the current bot short description for the given user language. Returns BotShortDescription on success.

params
FieldTypeDescription
language_codeOption<String>A two-letter ISO 639-1 language code or an empty string
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{GetMyShortDescriptionParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    // Optional parameters
    let params = GetMyShortDescriptionParams::new()
        .language_code(None);


    let result = bot.get_my_short_description(
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.get_my_star_balance()
async → StarAmount

A method to get the current Telegram Stars balance of the bot. Requires no parameters. On success, returns a StarAmount object.

no parameters
🔗
use tgbotrs::{Bot, BotError};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;


    let result = bot.get_my_star_balance().await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.get_star_transactions()
async → StarTransactions +opts

Returns the bot's Telegram Star transactions in chronological order. On success, returns a StarTransactions object.

params
FieldTypeDescription
offsetOption<i64>Number of transactions to skip in the response
limitOption<i64>The maximum number of transactions to be retrieved. Values between 1-100 are accepted. Defaults to 100.
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{GetStarTransactionsParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    // Optional parameters
    let params = GetStarTransactionsParams::new()
        .offset(None)
        .limit(None);


    let result = bot.get_star_transactions(
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.get_sticker_set()
async → StickerSet

Use this method to get a sticker set. On success, a StickerSet object is returned.

name
🔗
use tgbotrs::{Bot, BotError};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let name = "my_name";

    let result = bot.get_sticker_set(
        name
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.get_updates()
async → Vec<Update> +opts

Use this method to receive incoming updates using long polling (wiki). Returns an Array of Update objects.

params
FieldTypeDescription
offsetOption<i64>Identifier of the first update to be returned. Must be greater by one than the highest among the identifiers of previously received updates. By default, updates starting with the earliest unconfirmed update are returned. An update is considered confirmed as soon as getUpdates is called with an offset higher than its update_id. The negative offset can be specified to retrieve updates starting from -offset update from the end of the updates queue. All previous updates will be forgotten.
limitOption<i64>Limits the number of updates to be retrieved. Values between 1-100 are accepted. Defaults to 100.
timeoutOption<i64>Timeout in seconds for long polling. Defaults to 0, i.e. usual short polling. Should be positive, short polling should be used for testing purposes only.
allowed_updatesOption<Vec<String>>A JSON-serialized list of the update types you want your bot to receive. For example, specify ["message", "edited_channel_post", "callback_query"] to only receive updates of these types. See Update for a complete list of available update types. Specify an empty list to receive all update types except chat_member, message_reaction, and message_reaction_count (default). If not specified, the previous setting will be used. Please note that this parameter doesn't affect updates created before the call to getUpdates, so unwanted updates may be received for a short period of time.
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{GetUpdatesParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    // Optional parameters
    let params = GetUpdatesParams::new()
        .offset(None)
        .limit(None)
        .timeout(None)
        .allowed_updates(None);


    let result = bot.get_updates(
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.get_user_chat_boosts()
async → UserChatBoosts

Use this method to get the list of boosts added to a chat by a user. Requires administrator rights in the chat. Returns a UserChatBoosts object.

chat_iduser_id
🔗
use tgbotrs::{Bot, BotError};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let chat_id = 123456789i64;
    let user_id = 123456789i64;

    let result = bot.get_user_chat_boosts(
        chat_id,
        user_id
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.get_user_gifts()
async → OwnedGifts +opts

Returns the gifts owned and hosted by a user. Returns OwnedGifts on success.

user_idparams
FieldTypeDescription
exclude_unlimitedOption<bool>Pass True to exclude gifts that can be purchased an unlimited number of times
exclude_limited_upgradableOption<bool>Pass True to exclude gifts that can be purchased a limited number of times and can be upgraded to unique
exclude_limited_non_upgradableOption<bool>Pass True to exclude gifts that can be purchased a limited number of times and can't be upgraded to unique
exclude_from_blockchainOption<bool>Pass True to exclude gifts that were assigned from the TON blockchain and can't be resold or transferred in Telegram
exclude_uniqueOption<bool>Pass True to exclude unique gifts
sort_by_priceOption<bool>Pass True to sort results by gift price instead of send date. Sorting is applied before pagination.
offsetOption<String>Offset of the first entry to return as received from the previous request; use an empty string to get the first chunk of results
limitOption<i64>The maximum number of gifts to be returned; 1-100. Defaults to 100
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{GetUserGiftsParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let user_id = 123456789i64;
    // Optional parameters
    let params = GetUserGiftsParams::new()
        .exclude_unlimited(None)
        .exclude_limited_upgradable(None)
        .exclude_limited_non_upgradable(None)
        .exclude_from_blockchain(None)
        .exclude_unique(None)
        // ... +3 more optional fields;


    let result = bot.get_user_gifts(
        user_id,
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.get_user_profile_audios()
async → UserProfileAudios +opts

Use this method to get a list of profile audios for a user. Returns a UserProfileAudios object.

user_idparams
FieldTypeDescription
offsetOption<i64>Sequential number of the first audio to be returned. By default, all audios are returned.
limitOption<i64>Limits the number of audios to be retrieved. Values between 1-100 are accepted. Defaults to 100.
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{GetUserProfileAudiosParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let user_id = 123456789i64;
    // Optional parameters
    let params = GetUserProfileAudiosParams::new()
        .offset(None)
        .limit(None);


    let result = bot.get_user_profile_audios(
        user_id,
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.get_user_profile_photos()
async → UserProfilePhotos +opts

Use this method to get a list of profile pictures for a user. Returns a UserProfilePhotos object.

user_idparams
FieldTypeDescription
offsetOption<i64>Sequential number of the first photo to be returned. By default, all photos are returned.
limitOption<i64>Limits the number of photos to be retrieved. Values between 1-100 are accepted. Defaults to 100.
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{GetUserProfilePhotosParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let user_id = 123456789i64;
    // Optional parameters
    let params = GetUserProfilePhotosParams::new()
        .offset(None)
        .limit(None);


    let result = bot.get_user_profile_photos(
        user_id,
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.get_webhook_info()
async → WebhookInfo

Use this method to get current webhook status. Requires no parameters. On success, returns a WebhookInfo object. If the bot is using getUpdates, will return an object with the url field empty.

no parameters
🔗
use tgbotrs::{Bot, BotError};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;


    let result = bot.get_webhook_info().await?;
    println!("Result: {result:?}");
    Ok(())
}

Editing

12
bot.edit_forum_topic()
async → bool +opts

Use this method to edit name and icon of a topic in a forum supergroup chat or a private chat with a user. In the case of a supergroup chat the bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights, unless it is the creator of the topic. Returns True on success.

chat_idmessage_thread_idparams
FieldTypeDescription
nameOption<String>New topic name, 0-128 characters. If not specified or empty, the current name of the topic will be kept
icon_custom_emoji_idOption<String>New unique identifier of the custom emoji shown as the topic icon. Use getForumTopicIconStickers to get all allowed custom emoji identifiers. Pass an empty string to remove the icon. If not specified, the current icon will be kept
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{EditForumTopicParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let chat_id = 123456789i64;
    let message_thread_id = 0i64;
    // Optional parameters
    let params = EditForumTopicParams::new()
        .name(None)
        .icon_custom_emoji_id(None);


    let result = bot.edit_forum_topic(
        chat_id,
        message_thread_id,
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.edit_general_forum_topic()
async → bool

Use this method to edit the name of the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. Returns True on success.

chat_idname
🔗
use tgbotrs::{Bot, BotError};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let chat_id = 123456789i64;
    let name = "my_name";

    let result = bot.edit_general_forum_topic(
        chat_id,
        name
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.edit_message_caption()
async → serde_json::Value +opts

Use this method to edit captions of messages. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within 48 hours from the time they were sent.

params
FieldTypeDescription
business_connection_idOption<String>Unique identifier of the business connection on behalf of which the message to be edited was sent
chat_idOption<ChatId>Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
message_idOption<i64>Required if inline_message_id is not specified. Identifier of the message to edit
inline_message_idOption<String>Required if chat_id and message_id are not specified. Identifier of the inline message
captionOption<String>New caption of the message, 0-1024 characters after entities parsing
parse_modeOption<String>Mode for parsing entities in the message caption. See formatting options for more details.
caption_entitiesOption<Vec<MessageEntity>>A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode
show_caption_above_mediaOption<bool>Pass True, if the caption must be shown above the message media. Supported only for animation, photo and video messages.
reply_markupOption<Box<InlineKeyboardMarkup>>A JSON-serialized object for an inline keyboard.
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{EditMessageCaptionParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    // Optional parameters
    let params = EditMessageCaptionParams::new()
        .business_connection_id(None)
        .chat_id(None)
        .message_id(None)
        .inline_message_id(None)
        .caption(None)
        // ... +4 more optional fields;


    let result = bot.edit_message_caption(
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.edit_message_checklist()
async → Message +opts

Use this method to edit a checklist on behalf of a connected business account. On success, the edited Message is returned.

business_connection_idchat_idmessage_idchecklistparams
FieldTypeDescription
reply_markupOption<Box<InlineKeyboardMarkup>>A JSON-serialized object for the new inline keyboard for the message
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{EditMessageChecklistParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let business_connection_id = "example";
    let chat_id = 123456789i64;
    let message_id = 0i64;
    let checklist = InputChecklist::default();
    // Optional parameters
    let params = EditMessageChecklistParams::new()
        .reply_markup(None);


    let result = bot.edit_message_checklist(
        business_connection_id,
        chat_id,
        message_id,
        checklist,
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.edit_message_live_location()
async → serde_json::Value +opts

Use this method to edit live location messages. A location can be edited until its live_period expires or editing is explicitly disabled by a call to stopMessageLiveLocation. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned.

latitudelongitudeparams
FieldTypeDescription
business_connection_idOption<String>Unique identifier of the business connection on behalf of which the message to be edited was sent
chat_idOption<ChatId>Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
message_idOption<i64>Required if inline_message_id is not specified. Identifier of the message to edit
inline_message_idOption<String>Required if chat_id and message_id are not specified. Identifier of the inline message
live_periodOption<i64>New period in seconds during which the location can be updated, starting from the message send date. If 0x7FFFFFFF is specified, then the location can be updated forever. Otherwise, the new value must not exceed the current live_period by more than a day, and the live location expiration date must remain within the next 90 days. If not specified, then live_period remains unchanged
horizontal_accuracyOption<f64>The radius of uncertainty for the location, measured in meters; 0-1500
headingOption<i64>Direction in which the user is moving, in degrees. Must be between 1 and 360 if specified.
proximity_alert_radiusOption<i64>The maximum distance for proximity alerts about approaching another chat member, in meters. Must be between 1 and 100000 if specified.
reply_markupOption<Box<InlineKeyboardMarkup>>A JSON-serialized object for a new inline keyboard.
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{EditMessageLiveLocationParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let latitude = 0.0;
    let longitude = 0.0;
    // Optional parameters
    let params = EditMessageLiveLocationParams::new()
        .business_connection_id(None)
        .chat_id(None)
        .message_id(None)
        .inline_message_id(None)
        .live_period(None)
        // ... +4 more optional fields;


    let result = bot.edit_message_live_location(
        latitude,
        longitude,
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.edit_message_media()
async → serde_json::Value +opts

Use this method to edit animation, audio, document, photo, or video messages, or to add media to text messages. If a message is part of a message album, then it can be edited only to an audio for audio albums, only to a document for document albums and to a photo or a video otherwise. When an inline message is edited, a new file can't be uploaded; use a previously uploaded file via its file_id or specify a URL. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within 48 hours from the time they were sent.

mediaparams
FieldTypeDescription
business_connection_idOption<String>Unique identifier of the business connection on behalf of which the message to be edited was sent
chat_idOption<ChatId>Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
message_idOption<i64>Required if inline_message_id is not specified. Identifier of the message to edit
inline_message_idOption<String>Required if chat_id and message_id are not specified. Identifier of the inline message
reply_markupOption<Box<InlineKeyboardMarkup>>A JSON-serialized object for a new inline keyboard.
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{EditMessageMediaParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let media = todo!();
    // Optional parameters
    let params = EditMessageMediaParams::new()
        .business_connection_id(None)
        .chat_id(None)
        .message_id(None)
        .inline_message_id(None)
        .reply_markup(None);


    let result = bot.edit_message_media(
        media,
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.edit_message_reply_markup()
async → serde_json::Value +opts

Use this method to edit only the reply markup of messages. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within 48 hours from the time they were sent.

params
FieldTypeDescription
business_connection_idOption<String>Unique identifier of the business connection on behalf of which the message to be edited was sent
chat_idOption<ChatId>Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
message_idOption<i64>Required if inline_message_id is not specified. Identifier of the message to edit
inline_message_idOption<String>Required if chat_id and message_id are not specified. Identifier of the inline message
reply_markupOption<Box<InlineKeyboardMarkup>>A JSON-serialized object for an inline keyboard.
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{EditMessageReplyMarkupParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    // Optional parameters
    let params = EditMessageReplyMarkupParams::new()
        .business_connection_id(None)
        .chat_id(None)
        .message_id(None)
        .inline_message_id(None)
        .reply_markup(None);


    let result = bot.edit_message_reply_markup(
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.edit_message_text()
async → serde_json::Value +opts

Use this method to edit text and game messages. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within 48 hours from the time they were sent.

textparams
FieldTypeDescription
business_connection_idOption<String>Unique identifier of the business connection on behalf of which the message to be edited was sent
chat_idOption<ChatId>Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
message_idOption<i64>Required if inline_message_id is not specified. Identifier of the message to edit
inline_message_idOption<String>Required if chat_id and message_id are not specified. Identifier of the inline message
parse_modeOption<String>Mode for parsing entities in the message text. See formatting options for more details.
entitiesOption<Vec<MessageEntity>>A JSON-serialized list of special entities that appear in message text, which can be specified instead of parse_mode
link_preview_optionsOption<Box<LinkPreviewOptions>>Link preview generation options for the message
reply_markupOption<Box<InlineKeyboardMarkup>>A JSON-serialized object for an inline keyboard.
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{EditMessageTextParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let text = "Hello from tgbotrs! 🦀";
    // Optional parameters
    let params = EditMessageTextParams::new()
        .business_connection_id(None)
        .chat_id(None)
        .message_id(None)
        .inline_message_id(None)
        .parse_mode(None)
        // ... +3 more optional fields;


    let result = bot.edit_message_text(
        text,
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.edit_story()
async → Story +opts

Edits a story previously posted by the bot on behalf of a managed business account. Requires the can_manage_stories business bot right. Returns Story on success.

business_connection_idstory_idcontentparams
FieldTypeDescription
captionOption<String>Caption of the story, 0-2048 characters after entities parsing
parse_modeOption<String>Mode for parsing entities in the story caption. See formatting options for more details.
caption_entitiesOption<Vec<MessageEntity>>A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode
areasOption<Vec<StoryArea>>A JSON-serialized list of clickable areas to be shown on the story
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{EditStoryParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let business_connection_id = "example";
    let story_id = 0i64;
    let content = InputStoryContent::default();
    // Optional parameters
    let params = EditStoryParams::new()
        .caption(None)
        .parse_mode(None)
        .caption_entities(None)
        .areas(None);


    let result = bot.edit_story(
        business_connection_id,
        story_id,
        content,
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.edit_user_star_subscription()
async → bool

Allows the bot to cancel or re-enable extension of a subscription paid in Telegram Stars. Returns True on success.

user_idtelegram_payment_charge_idis_canceled
🔗
use tgbotrs::{Bot, BotError};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let user_id = 123456789i64;
    let telegram_payment_charge_id = "example";
    let is_canceled = true;

    let result = bot.edit_user_star_subscription(
        user_id,
        telegram_payment_charge_id,
        is_canceled
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}

Deletion

11
bot.delete_business_messages()
async → bool

Delete messages on behalf of a business account. Requires the can_delete_sent_messages business bot right to delete messages sent by the bot itself, or the can_delete_all_messages business bot right to delete any message. Returns True on success.

business_connection_idmessage_ids
🔗
use tgbotrs::{Bot, BotError};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let business_connection_id = "example";
    let message_ids = vec![]  // Vec<i64>;

    let result = bot.delete_business_messages(
        business_connection_id,
        message_ids
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.delete_chat_photo()
async → bool

Use this method to delete a chat photo. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success.

chat_id
🔗
use tgbotrs::{Bot, BotError};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let chat_id = 123456789i64;

    let result = bot.delete_chat_photo(
        chat_id
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.delete_chat_sticker_set()
async → bool

Use this method to delete a group sticker set from a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Use the field can_set_sticker_set optionally returned in getChat requests to check if the bot can use this method. Returns True on success.

chat_id
🔗
use tgbotrs::{Bot, BotError};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let chat_id = 123456789i64;

    let result = bot.delete_chat_sticker_set(
        chat_id
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.delete_forum_topic()
async → bool

Use this method to delete a forum topic along with all its messages in a forum supergroup chat or a private chat with a user. In the case of a supergroup chat the bot must be an administrator in the chat for this to work and must have the can_delete_messages administrator rights. Returns True on success.

chat_idmessage_thread_id
🔗
use tgbotrs::{Bot, BotError};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let chat_id = 123456789i64;
    let message_thread_id = 0i64;

    let result = bot.delete_forum_topic(
        chat_id,
        message_thread_id
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.delete_message()
async → bool

Use this method to delete a message, including service messages, with the following limitations: /// - A message can only be deleted if it was sent less than 48 hours ago. /// - Service messages about a supergroup, channel, or forum topic creation can't be deleted. /// - A dice message in a private chat can only be deleted if it was sent more than 24 hours ago. /// - Bots can delete outgoing messages in private chats, groups, and supergroups. /// - Bots can delete incoming messages in private chats. /// - Bots granted can_post_messages permissions can delete outgoing messages in channels. /// - If the bot is an administrator of a group, it can delete any message there. /// - If the bot has can_delete_messages administrator right in a supergroup or a channel, it can delete any message there. /// - If the bot has can_manage_direct_messages administrator right in a channel, it can delete any message in the corresponding direct messages chat. /// Returns True on success.

chat_idmessage_id
🔗
use tgbotrs::{Bot, BotError};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let chat_id = 123456789i64;
    let message_id = 0i64;

    let result = bot.delete_message(
        chat_id,
        message_id
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.delete_messages()
async → bool

Use this method to delete multiple messages simultaneously. If some of the specified messages can't be found, they are skipped. Returns True on success.

chat_idmessage_ids
🔗
use tgbotrs::{Bot, BotError};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let chat_id = 123456789i64;
    let message_ids = vec![]  // Vec<i64>;

    let result = bot.delete_messages(
        chat_id,
        message_ids
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.delete_my_commands()
async → bool +opts

Use this method to delete the list of the bot's commands for the given scope and user language. After deletion, higher level commands will be shown to affected users. Returns True on success.

params
FieldTypeDescription
scopeOption<Box<BotCommandScope>>A JSON-serialized object, describing scope of users for which the commands are relevant. Defaults to BotCommandScopeDefault.
language_codeOption<String>A two-letter ISO 639-1 language code. If empty, commands will be applied to all users from the given scope, for whose language there are no dedicated commands
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{DeleteMyCommandsParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    // Optional parameters
    let params = DeleteMyCommandsParams::new()
        .scope(None)
        .language_code(None);


    let result = bot.delete_my_commands(
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.delete_sticker_from_set()
async → bool

Use this method to delete a sticker from a set created by the bot. Returns True on success.

sticker
🔗
use tgbotrs::{Bot, BotError};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let sticker = "example";

    let result = bot.delete_sticker_from_set(
        sticker
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.delete_sticker_set()
async → bool

Use this method to delete a sticker set that was created by the bot. Returns True on success.

name
🔗
use tgbotrs::{Bot, BotError};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let name = "my_name";

    let result = bot.delete_sticker_set(
        name
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.delete_story()
async → bool

Deletes a story previously posted by the bot on behalf of a managed business account. Requires the can_manage_stories business bot right. Returns True on success.

business_connection_idstory_id
🔗
use tgbotrs::{Bot, BotError};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let business_connection_id = "example";
    let story_id = 0i64;

    let result = bot.delete_story(
        business_connection_id,
        story_id
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.delete_webhook()
async → bool +opts

Use this method to remove webhook integration if you decide to switch back to getUpdates. Returns True on success.

params
FieldTypeDescription
drop_pending_updatesOption<bool>Pass True to drop all pending updates
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{DeleteWebhookParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    // Optional parameters
    let params = DeleteWebhookParams::new()
        .drop_pending_updates(None);


    let result = bot.delete_webhook(
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}

Forwarding & Copying

4
bot.copy_message()
async → MessageId +opts

Use this method to copy messages of any kind. Service messages, paid media messages, giveaway messages, giveaway winners messages, and invoice messages can't be copied. A quiz poll can be copied only if the value of the field correct_option_id is known to the bot. The method is analogous to the method forwardMessage, but the copied message doesn't have a link to the original message. Returns the MessageId of the sent message on success.

chat_idfrom_chat_idmessage_idparams
FieldTypeDescription
message_thread_idOption<i64>Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only
direct_messages_topic_idOption<i64>Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat
video_start_timestampOption<i64>New start timestamp for the copied video in the message
captionOption<String>New caption for media, 0-1024 characters after entities parsing. If not specified, the original caption is kept
parse_modeOption<String>Mode for parsing entities in the new caption. See formatting options for more details.
caption_entitiesOption<Vec<MessageEntity>>A JSON-serialized list of special entities that appear in the new caption, which can be specified instead of parse_mode
show_caption_above_mediaOption<bool>Pass True, if the caption must be shown above the message media. Ignored if a new caption isn't specified.
disable_notificationOption<bool>Sends the message silently. Users will receive a notification with no sound.
protect_contentOption<bool>Protects the contents of the sent message from forwarding and saving
allow_paid_broadcastOption<bool>Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance
message_effect_idOption<String>Unique identifier of the message effect to be added to the message; only available when copying to private chats
suggested_post_parametersOption<Box<SuggestedPostParameters>>A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined.
reply_parametersOption<Box<ReplyParameters>>Description of the message to reply to
reply_markupOption<ReplyMarkup>Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{CopyMessageParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let chat_id = 123456789i64;
    let from_chat_id = 123456789i64;
    let message_id = 0i64;
    // Optional parameters
    let params = CopyMessageParams::new()
        .message_thread_id(None)
        .direct_messages_topic_id(None)
        .video_start_timestamp(None)
        .caption(None)
        .parse_mode(None)
        // ... +9 more optional fields;


    let result = bot.copy_message(
        chat_id,
        from_chat_id,
        message_id,
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.copy_messages()
async → Vec<MessageId> +opts

Use this method to copy messages of any kind. If some of the specified messages can't be found or copied, they are skipped. Service messages, paid media messages, giveaway messages, giveaway winners messages, and invoice messages can't be copied. A quiz poll can be copied only if the value of the field correct_option_id is known to the bot. The method is analogous to the method forwardMessages, but the copied messages don't have a link to the original message. Album grouping is kept for copied messages. On success, an array of MessageId of the sent messages is returned.

chat_idfrom_chat_idmessage_idsparams
FieldTypeDescription
message_thread_idOption<i64>Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only
direct_messages_topic_idOption<i64>Identifier of the direct messages topic to which the messages will be sent; required if the messages are sent to a direct messages chat
disable_notificationOption<bool>Sends the messages silently. Users will receive a notification with no sound.
protect_contentOption<bool>Protects the contents of the sent messages from forwarding and saving
remove_captionOption<bool>Pass True to copy the messages without their captions
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{CopyMessagesParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let chat_id = 123456789i64;
    let from_chat_id = 123456789i64;
    let message_ids = vec![]  // Vec<i64>;
    // Optional parameters
    let params = CopyMessagesParams::new()
        .message_thread_id(None)
        .direct_messages_topic_id(None)
        .disable_notification(None)
        .protect_content(None)
        .remove_caption(None);


    let result = bot.copy_messages(
        chat_id,
        from_chat_id,
        message_ids,
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.forward_message()
async → Message +opts

Use this method to forward messages of any kind. Service messages and messages with protected content can't be forwarded. On success, the sent Message is returned.

chat_idfrom_chat_idmessage_idparams
FieldTypeDescription
message_thread_idOption<i64>Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only
direct_messages_topic_idOption<i64>Identifier of the direct messages topic to which the message will be forwarded; required if the message is forwarded to a direct messages chat
video_start_timestampOption<i64>New start timestamp for the forwarded video in the message
disable_notificationOption<bool>Sends the message silently. Users will receive a notification with no sound.
protect_contentOption<bool>Protects the contents of the forwarded message from forwarding and saving
message_effect_idOption<String>Unique identifier of the message effect to be added to the message; only available when forwarding to private chats
suggested_post_parametersOption<Box<SuggestedPostParameters>>A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{ForwardMessageParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let chat_id = 123456789i64;
    let from_chat_id = 123456789i64;
    let message_id = 0i64;
    // Optional parameters
    let params = ForwardMessageParams::new()
        .message_thread_id(None)
        .direct_messages_topic_id(None)
        .video_start_timestamp(None)
        .disable_notification(None)
        .protect_content(None)
        // ... +2 more optional fields;


    let result = bot.forward_message(
        chat_id,
        from_chat_id,
        message_id,
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.forward_messages()
async → Vec<MessageId> +opts

Use this method to forward multiple messages of any kind. If some of the specified messages can't be found or forwarded, they are skipped. Service messages and messages with protected content can't be forwarded. Album grouping is kept for forwarded messages. On success, an array of MessageId of the sent messages is returned.

chat_idfrom_chat_idmessage_idsparams
FieldTypeDescription
message_thread_idOption<i64>Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only
direct_messages_topic_idOption<i64>Identifier of the direct messages topic to which the messages will be forwarded; required if the messages are forwarded to a direct messages chat
disable_notificationOption<bool>Sends the messages silently. Users will receive a notification with no sound.
protect_contentOption<bool>Protects the contents of the forwarded messages from forwarding and saving
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{ForwardMessagesParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let chat_id = 123456789i64;
    let from_chat_id = 123456789i64;
    let message_ids = vec![]  // Vec<i64>;
    // Optional parameters
    let params = ForwardMessagesParams::new()
        .message_thread_id(None)
        .direct_messages_topic_id(None)
        .disable_notification(None)
        .protect_content(None);


    let result = bot.forward_messages(
        chat_id,
        from_chat_id,
        message_ids,
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}

Answering Queries

5
bot.answer_callback_query()
async → bool +opts

Use this method to send answers to callback queries sent from inline keyboards. The answer will be displayed to the user as a notification at the top of the chat screen or as an alert. On success, True is returned.

callback_query_idparams
FieldTypeDescription
textOption<String>Text of the notification. If not specified, nothing will be shown to the user, 0-200 characters
show_alertOption<bool>If True, an alert will be shown by the client instead of a notification at the top of the chat screen. Defaults to false.
urlOption<String>URL that will be opened by the user's client. If you have created a Game and accepted the conditions via @BotFather, specify the URL that opens your game - note that this will only work if the query comes from a callback_game button. Otherwise, you may use links like t.me/your_bot?start=XXXX that open your bot with a parameter.
cache_timeOption<i64>The maximum amount of time in seconds that the result of the callback query may be cached client-side. Telegram apps will support caching starting in version 3.14. Defaults to 0.
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{AnswerCallbackQueryParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let callback_query_id = "example";
    // Optional parameters
    let params = AnswerCallbackQueryParams::new()
        .text(None)
        .show_alert(None)
        .url(None)
        .cache_time(None);


    let result = bot.answer_callback_query(
        callback_query_id,
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.answer_inline_query()
async → bool +opts

Use this method to send answers to an inline query. On success, True is returned. /// No more than 50 results per query are allowed.

inline_query_idresultsparams
FieldTypeDescription
cache_timeOption<i64>The maximum amount of time in seconds that the result of the inline query may be cached on the server. Defaults to 300.
is_personalOption<bool>Pass True if results may be cached on the server side only for the user that sent the query. By default, results may be returned to any user who sends the same query.
next_offsetOption<String>Pass the offset that a client should send in the next query with the same text to receive more results. Pass an empty string if there are no more results or if you don't support pagination. Offset length can't exceed 64 bytes.
buttonOption<Box<InlineQueryResultsButton>>A JSON-serialized object describing a button to be shown above inline query results
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{AnswerInlineQueryParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let inline_query_id = "example";
    let results = vec![]  // Vec<InlineQueryResult>;
    // Optional parameters
    let params = AnswerInlineQueryParams::new()
        .cache_time(None)
        .is_personal(None)
        .next_offset(None)
        .button(None);


    let result = bot.answer_inline_query(
        inline_query_id,
        results,
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.answer_pre_checkout_query()
async → bool +opts

Once the user has confirmed their payment and shipping details, the Bot API sends the final confirmation in the form of an Update with the field pre_checkout_query. Use this method to respond to such pre-checkout queries. On success, True is returned. Note: The Bot API must receive an answer within 10 seconds after the pre-checkout query was sent.

pre_checkout_query_idokparams
FieldTypeDescription
error_messageOption<String>Required if ok is False. Error message in human readable form that explains the reason for failure to proceed with the checkout (e.g. "Sorry, somebody just bought the last of our amazing black T-shirts while you were busy filling out your payment details. Please choose a different color or garment!"). Telegram will display this message to the user.
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{AnswerPreCheckoutQueryParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let pre_checkout_query_id = "example";
    let ok = true;
    // Optional parameters
    let params = AnswerPreCheckoutQueryParams::new()
        .error_message(None);


    let result = bot.answer_pre_checkout_query(
        pre_checkout_query_id,
        ok,
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.answer_shipping_query()
async → bool +opts

If you sent an invoice requesting a shipping address and the parameter is_flexible was specified, the Bot API will send an Update with a shipping_query field to the bot. Use this method to reply to shipping queries. On success, True is returned.

shipping_query_idokparams
FieldTypeDescription
shipping_optionsOption<Vec<ShippingOption>>Required if ok is True. A JSON-serialized array of available shipping options.
error_messageOption<String>Required if ok is False. Error message in human readable form that explains why it is impossible to complete the order (e.g. "Sorry, delivery to your desired address is unavailable"). Telegram will display this message to the user.
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{AnswerShippingQueryParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let shipping_query_id = "example";
    let ok = true;
    // Optional parameters
    let params = AnswerShippingQueryParams::new()
        .shipping_options(None)
        .error_message(None);


    let result = bot.answer_shipping_query(
        shipping_query_id,
        ok,
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.answer_web_app_query()
async → SentWebAppMessage

Use this method to set the result of an interaction with a Web App and send a corresponding message on behalf of the user to the chat from which the query originated. On success, a SentWebAppMessage object is returned.

web_app_query_idresult
🔗
use tgbotrs::{Bot, BotError};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let web_app_query_id = "example";
    let result = InlineQueryResult::default();

    let result = bot.answer_web_app_query(
        web_app_query_id,
        result
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}

Chat Administration

6
bot.ban_chat_member()
async → bool +opts

Use this method to ban a user in a group, a supergroup or a channel. In the case of supergroups and channels, the user will not be able to return to the chat on their own using invite links, etc., unless unbanned first. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success.

chat_iduser_idparams
FieldTypeDescription
until_dateOption<i64>Date when the user will be unbanned; Unix time. If user is banned for more than 366 days or less than 30 seconds from the current time they are considered to be banned forever. Applied for supergroups and channels only.
revoke_messagesOption<bool>Pass True to delete all messages from the chat for the user that is being removed. If False, the user will be able to see messages in the group that were sent before the user was removed. Always True for supergroups and channels.
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{BanChatMemberParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let chat_id = 123456789i64;
    let user_id = 123456789i64;
    // Optional parameters
    let params = BanChatMemberParams::new()
        .until_date(None)
        .revoke_messages(None);


    let result = bot.ban_chat_member(
        chat_id,
        user_id,
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.ban_chat_sender_chat()
async → bool

Use this method to ban a channel chat in a supergroup or a channel. Until the chat is unbanned, the owner of the banned chat won't be able to send messages on behalf of any of their channels. The bot must be an administrator in the supergroup or channel for this to work and must have the appropriate administrator rights. Returns True on success.

chat_idsender_chat_id
🔗
use tgbotrs::{Bot, BotError};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let chat_id = 123456789i64;
    let sender_chat_id = 123456789i64;

    let result = bot.ban_chat_sender_chat(
        chat_id,
        sender_chat_id
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.promote_chat_member()
async → bool +opts

Use this method to promote or demote a user in a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Pass False for all boolean parameters to demote a user. Returns True on success.

chat_iduser_idparams
FieldTypeDescription
is_anonymousOption<bool>Pass True if the administrator's presence in the chat is hidden
can_manage_chatOption<bool>Pass True if the administrator can access the chat event log, get boost list, see hidden supergroup and channel members, report spam messages, ignore slow mode, and send messages to the chat without paying Telegram Stars. Implied by any other administrator privilege.
can_delete_messagesOption<bool>Pass True if the administrator can delete messages of other users
can_manage_video_chatsOption<bool>Pass True if the administrator can manage video chats
can_restrict_membersOption<bool>Pass True if the administrator can restrict, ban or unban chat members, or access supergroup statistics. For backward compatibility, defaults to True for promotions of channel administrators
can_promote_membersOption<bool>Pass True if the administrator can add new administrators with a subset of their own privileges or demote administrators that they have promoted, directly or indirectly (promoted by administrators that were appointed by him)
can_change_infoOption<bool>Pass True if the administrator can change chat title, photo and other settings
can_invite_usersOption<bool>Pass True if the administrator can invite new users to the chat
can_post_storiesOption<bool>Pass True if the administrator can post stories to the chat
can_edit_storiesOption<bool>Pass True if the administrator can edit stories posted by other users, post stories to the chat page, pin chat stories, and access the chat's story archive
can_delete_storiesOption<bool>Pass True if the administrator can delete stories posted by other users
can_post_messagesOption<bool>Pass True if the administrator can post messages in the channel, approve suggested posts, or access channel statistics; for channels only
can_edit_messagesOption<bool>Pass True if the administrator can edit messages of other users and can pin messages; for channels only
can_pin_messagesOption<bool>Pass True if the administrator can pin messages; for supergroups only
can_manage_topicsOption<bool>Pass True if the user is allowed to create, rename, close, and reopen forum topics; for supergroups only
can_manage_direct_messagesOption<bool>Pass True if the administrator can manage direct messages within the channel and decline suggested posts; for channels only
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{PromoteChatMemberParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let chat_id = 123456789i64;
    let user_id = 123456789i64;
    // Optional parameters
    let params = PromoteChatMemberParams::new()
        .is_anonymous(None)
        .can_manage_chat(None)
        .can_delete_messages(None)
        .can_manage_video_chats(None)
        .can_restrict_members(None)
        // ... +11 more optional fields;


    let result = bot.promote_chat_member(
        chat_id,
        user_id,
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.restrict_chat_member()
async → bool +opts

Use this method to restrict a user in a supergroup. The bot must be an administrator in the supergroup for this to work and must have the appropriate administrator rights. Pass True for all permissions to lift restrictions from a user. Returns True on success.

chat_iduser_idpermissionsparams
FieldTypeDescription
use_independent_chat_permissionsOption<bool>Pass True if chat permissions are set independently. Otherwise, the can_send_other_messages and can_add_web_page_previews permissions will imply the can_send_messages, can_send_audios, can_send_documents, can_send_photos, can_send_videos, can_send_video_notes, and can_send_voice_notes permissions; the can_send_polls permission will imply the can_send_messages permission.
until_dateOption<i64>Date when restrictions will be lifted for the user; Unix time. If user is restricted for more than 366 days or less than 30 seconds from the current time, they are considered to be restricted forever
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{RestrictChatMemberParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let chat_id = 123456789i64;
    let user_id = 123456789i64;
    let permissions = ChatPermissions::default();
    // Optional parameters
    let params = RestrictChatMemberParams::new()
        .use_independent_chat_permissions(None)
        .until_date(None);


    let result = bot.restrict_chat_member(
        chat_id,
        user_id,
        permissions,
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.unban_chat_member()
async → bool +opts

Use this method to unban a previously banned user in a supergroup or channel. The user will not return to the group or channel automatically, but will be able to join via link, etc. The bot must be an administrator for this to work. By default, this method guarantees that after the call the user is not a member of the chat, but will be able to join it. So if the user is a member of the chat they will also be removed from the chat. If you don't want this, use the parameter only_if_banned. Returns True on success.

chat_iduser_idparams
FieldTypeDescription
only_if_bannedOption<bool>Do nothing if the user is not banned
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{UnbanChatMemberParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let chat_id = 123456789i64;
    let user_id = 123456789i64;
    // Optional parameters
    let params = UnbanChatMemberParams::new()
        .only_if_banned(None);


    let result = bot.unban_chat_member(
        chat_id,
        user_id,
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.unban_chat_sender_chat()
async → bool

Use this method to unban a previously banned channel chat in a supergroup or channel. The bot must be an administrator for this to work and must have the appropriate administrator rights. Returns True on success.

chat_idsender_chat_id
🔗
use tgbotrs::{Bot, BotError};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let chat_id = 123456789i64;
    let sender_chat_id = 123456789i64;

    let result = bot.unban_chat_sender_chat(
        chat_id,
        sender_chat_id
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}

Invite & Membership

10
bot.approve_chat_join_request()
async → bool

Use this method to approve a chat join request. The bot must be an administrator in the chat for this to work and must have the can_invite_users administrator right. Returns True on success.

chat_iduser_id
🔗
use tgbotrs::{Bot, BotError};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let chat_id = 123456789i64;
    let user_id = 123456789i64;

    let result = bot.approve_chat_join_request(
        chat_id,
        user_id
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.approve_suggested_post()
async → bool +opts

Use this method to approve a suggested post in a direct messages chat. The bot must have the 'can_post_messages' administrator right in the corresponding channel chat. Returns True on success.

chat_idmessage_idparams
FieldTypeDescription
send_dateOption<i64>Point in time (Unix timestamp) when the post is expected to be published; omit if the date has already been specified when the suggested post was created. If specified, then the date must be not more than 2678400 seconds (30 days) in the future
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{ApproveSuggestedPostParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let chat_id = 123456789i64;
    let message_id = 0i64;
    // Optional parameters
    let params = ApproveSuggestedPostParams::new()
        .send_date(None);


    let result = bot.approve_suggested_post(
        chat_id,
        message_id,
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.create_forum_topic()
async → ForumTopic +opts

Use this method to create a topic in a forum supergroup chat or a private chat with a user. In the case of a supergroup chat the bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator right. Returns information about the created topic as a ForumTopic object.

chat_idnameparams
FieldTypeDescription
icon_colorOption<i64>Color of the topic icon in RGB format. Currently, must be one of 7322096 (0x6FB9F0), 16766590 (0xFFD67E), 13338331 (0xCB86DB), 9367192 (0x8EEE98), 16749490 (0xFF93B2), or 16478047 (0xFB6F5F)
icon_custom_emoji_idOption<String>Unique identifier of the custom emoji shown as the topic icon. Use getForumTopicIconStickers to get all allowed custom emoji identifiers.
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{CreateForumTopicParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let chat_id = 123456789i64;
    let name = "my_name";
    // Optional parameters
    let params = CreateForumTopicParams::new()
        .icon_color(None)
        .icon_custom_emoji_id(None);


    let result = bot.create_forum_topic(
        chat_id,
        name,
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.create_new_sticker_set()
async → bool +opts

Use this method to create a new sticker set owned by a user. The bot will be able to edit the sticker set thus created. Returns True on success.

user_idnametitlestickersparams
FieldTypeDescription
sticker_typeOption<String>Type of stickers in the set, pass "regular", "mask", or "custom_emoji". By default, a regular sticker set is created.
needs_repaintingOption<bool>Pass True if stickers in the sticker set must be repainted to the color of text when used in messages, the accent color if used as emoji status, white on chat photos, or another appropriate color based on context; for custom emoji sticker sets only
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{CreateNewStickerSetParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let user_id = 123456789i64;
    let name = "my_name";
    let title = "example";
    let stickers = vec![]  // Vec<InputSticker>;
    // Optional parameters
    let params = CreateNewStickerSetParams::new()
        .sticker_type(None)
        .needs_repainting(None);


    let result = bot.create_new_sticker_set(
        user_id,
        name,
        title,
        stickers,
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.decline_chat_join_request()
async → bool

Use this method to decline a chat join request. The bot must be an administrator in the chat for this to work and must have the can_invite_users administrator right. Returns True on success.

chat_iduser_id
🔗
use tgbotrs::{Bot, BotError};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let chat_id = 123456789i64;
    let user_id = 123456789i64;

    let result = bot.decline_chat_join_request(
        chat_id,
        user_id
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.decline_suggested_post()
async → bool +opts

Use this method to decline a suggested post in a direct messages chat. The bot must have the 'can_manage_direct_messages' administrator right in the corresponding channel chat. Returns True on success.

chat_idmessage_idparams
FieldTypeDescription
commentOption<String>Comment for the creator of the suggested post; 0-128 characters
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{DeclineSuggestedPostParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let chat_id = 123456789i64;
    let message_id = 0i64;
    // Optional parameters
    let params = DeclineSuggestedPostParams::new()
        .comment(None);


    let result = bot.decline_suggested_post(
        chat_id,
        message_id,
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}

Pinning

5
bot.pin_chat_message()
async → bool +opts

Use this method to add a message to the list of pinned messages in a chat. In private chats and channel direct messages chats, all non-service messages can be pinned. Conversely, the bot must be an administrator with the 'can_pin_messages' right or the 'can_edit_messages' right to pin messages in groups and channels respectively. Returns True on success.

chat_idmessage_idparams
FieldTypeDescription
business_connection_idOption<String>Unique identifier of the business connection on behalf of which the message will be pinned
disable_notificationOption<bool>Pass True if it is not necessary to send a notification to all chat members about the new pinned message. Notifications are always disabled in channels and private chats.
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{PinChatMessageParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let chat_id = 123456789i64;
    let message_id = 0i64;
    // Optional parameters
    let params = PinChatMessageParams::new()
        .business_connection_id(None)
        .disable_notification(None);


    let result = bot.pin_chat_message(
        chat_id,
        message_id,
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.unpin_all_chat_messages()
async → bool

Use this method to clear the list of pinned messages in a chat. In private chats and channel direct messages chats, no additional rights are required to unpin all pinned messages. Conversely, the bot must be an administrator with the 'can_pin_messages' right or the 'can_edit_messages' right to unpin all pinned messages in groups and channels respectively. Returns True on success.

chat_id
🔗
use tgbotrs::{Bot, BotError};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let chat_id = 123456789i64;

    let result = bot.unpin_all_chat_messages(
        chat_id
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.unpin_all_forum_topic_messages()
async → bool

Use this method to clear the list of pinned messages in a forum topic in a forum supergroup chat or a private chat with a user. In the case of a supergroup chat the bot must be an administrator in the chat for this to work and must have the can_pin_messages administrator right in the supergroup. Returns True on success.

chat_idmessage_thread_id
🔗
use tgbotrs::{Bot, BotError};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let chat_id = 123456789i64;
    let message_thread_id = 0i64;

    let result = bot.unpin_all_forum_topic_messages(
        chat_id,
        message_thread_id
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.unpin_all_general_forum_topic_messages()
async → bool

Use this method to clear the list of pinned messages in a General forum topic. The bot must be an administrator in the chat for this to work and must have the can_pin_messages administrator right in the supergroup. Returns True on success.

chat_id
🔗
use tgbotrs::{Bot, BotError};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let chat_id = 123456789i64;

    let result = bot.unpin_all_general_forum_topic_messages(
        chat_id
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.unpin_chat_message()
async → bool +opts

Use this method to remove a message from the list of pinned messages in a chat. In private chats and channel direct messages chats, all messages can be unpinned. Conversely, the bot must be an administrator with the 'can_pin_messages' right or the 'can_edit_messages' right to unpin messages in groups and channels respectively. Returns True on success.

chat_idparams
FieldTypeDescription
business_connection_idOption<String>Unique identifier of the business connection on behalf of which the message will be unpinned
message_idOption<i64>Identifier of the message to unpin. Required if business_connection_id is specified. If not specified, the most recent pinned message (by sending date) will be unpinned.
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{UnpinChatMessageParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let chat_id = 123456789i64;
    // Optional parameters
    let params = UnpinChatMessageParams::new()
        .business_connection_id(None)
        .message_id(None);


    let result = bot.unpin_chat_message(
        chat_id,
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}

Configuration

30
bot.set_business_account_bio()
async → bool +opts

Changes the bio of a managed business account. Requires the can_change_bio business bot right. Returns True on success.

business_connection_idparams
FieldTypeDescription
bioOption<String>The new value of the bio for the business account; 0-140 characters
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{SetBusinessAccountBioParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let business_connection_id = "example";
    // Optional parameters
    let params = SetBusinessAccountBioParams::new()
        .bio(None);


    let result = bot.set_business_account_bio(
        business_connection_id,
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.set_business_account_gift_settings()
async → bool

Changes the privacy settings pertaining to incoming gifts in a managed business account. Requires the can_change_gift_settings business bot right. Returns True on success.

business_connection_idshow_gift_buttonaccepted_gift_types
🔗
use tgbotrs::{Bot, BotError};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let business_connection_id = "example";
    let show_gift_button = true;
    let accepted_gift_types = AcceptedGiftTypes::default();

    let result = bot.set_business_account_gift_settings(
        business_connection_id,
        show_gift_button,
        accepted_gift_types
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.set_business_account_name()
async → bool +opts

Changes the first and last name of a managed business account. Requires the can_change_name business bot right. Returns True on success.

business_connection_idfirst_nameparams
FieldTypeDescription
last_nameOption<String>The new value of the last name for the business account; 0-64 characters
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{SetBusinessAccountNameParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let business_connection_id = "example";
    let first_name = "my_name";
    // Optional parameters
    let params = SetBusinessAccountNameParams::new()
        .last_name(None);


    let result = bot.set_business_account_name(
        business_connection_id,
        first_name,
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.set_business_account_profile_photo()
async → bool +opts

Changes the profile photo of a managed business account. Requires the can_edit_profile_photo business bot right. Returns True on success.

business_connection_idphotoparams
FieldTypeDescription
is_publicOption<bool>Pass True to set the public photo, which will be visible even if the main photo is hidden by the business account's privacy settings. An account can have only one public photo.
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{SetBusinessAccountProfilePhotoParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let business_connection_id = "example";
    let photo = InputProfilePhoto::default();
    // Optional parameters
    let params = SetBusinessAccountProfilePhotoParams::new()
        .is_public(None);


    let result = bot.set_business_account_profile_photo(
        business_connection_id,
        photo,
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.set_business_account_username()
async → bool +opts

Changes the username of a managed business account. Requires the can_change_username business bot right. Returns True on success.

business_connection_idparams
FieldTypeDescription
usernameOption<String>The new value of the username for the business account; 0-32 characters
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{SetBusinessAccountUsernameParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let business_connection_id = "example";
    // Optional parameters
    let params = SetBusinessAccountUsernameParams::new()
        .username(None);


    let result = bot.set_business_account_username(
        business_connection_id,
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.set_chat_administrator_custom_title()
async → bool

Use this method to set a custom title for an administrator in a supergroup promoted by the bot. Returns True on success.

chat_iduser_idcustom_title
🔗
use tgbotrs::{Bot, BotError};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let chat_id = 123456789i64;
    let user_id = 123456789i64;
    let custom_title = "example";

    let result = bot.set_chat_administrator_custom_title(
        chat_id,
        user_id,
        custom_title
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.set_chat_description()
async → bool +opts

Use this method to change the description of a group, a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success.

chat_idparams
FieldTypeDescription
descriptionOption<String>New chat description, 0-255 characters
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{SetChatDescriptionParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let chat_id = 123456789i64;
    // Optional parameters
    let params = SetChatDescriptionParams::new()
        .description(None);


    let result = bot.set_chat_description(
        chat_id,
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.set_chat_menu_button()
async → bool +opts

Use this method to change the bot's menu button in a private chat, or the default menu button. Returns True on success.

params
FieldTypeDescription
chat_idOption<i64>Unique identifier for the target private chat. If not specified, default bot's menu button will be changed
menu_buttonOption<Box<MenuButton>>A JSON-serialized object for the bot's new menu button. Defaults to MenuButtonDefault
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{SetChatMenuButtonParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    // Optional parameters
    let params = SetChatMenuButtonParams::new()
        .chat_id(None)
        .menu_button(None);


    let result = bot.set_chat_menu_button(
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.set_chat_permissions()
async → bool +opts

Use this method to set default chat permissions for all members. The bot must be an administrator in the group or a supergroup for this to work and must have the can_restrict_members administrator rights. Returns True on success.

chat_idpermissionsparams
FieldTypeDescription
use_independent_chat_permissionsOption<bool>Pass True if chat permissions are set independently. Otherwise, the can_send_other_messages and can_add_web_page_previews permissions will imply the can_send_messages, can_send_audios, can_send_documents, can_send_photos, can_send_videos, can_send_video_notes, and can_send_voice_notes permissions; the can_send_polls permission will imply the can_send_messages permission.
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{SetChatPermissionsParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let chat_id = 123456789i64;
    let permissions = ChatPermissions::default();
    // Optional parameters
    let params = SetChatPermissionsParams::new()
        .use_independent_chat_permissions(None);


    let result = bot.set_chat_permissions(
        chat_id,
        permissions,
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.set_chat_photo()
async → bool

Use this method to set a new profile photo for the chat. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success.

chat_idphoto
🔗
use tgbotrs::{Bot, BotError};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let chat_id = 123456789i64;
    let photo = InputFile::default();

    let result = bot.set_chat_photo(
        chat_id,
        photo
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.set_chat_sticker_set()
async → bool

Use this method to set a new group sticker set for a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Use the field can_set_sticker_set optionally returned in getChat requests to check if the bot can use this method. Returns True on success.

chat_idsticker_set_name
🔗
use tgbotrs::{Bot, BotError};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let chat_id = 123456789i64;
    let sticker_set_name = "my_name";

    let result = bot.set_chat_sticker_set(
        chat_id,
        sticker_set_name
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.set_chat_title()
async → bool

Use this method to change the title of a chat. Titles can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success.

chat_idtitle
🔗
use tgbotrs::{Bot, BotError};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let chat_id = 123456789i64;
    let title = "example";

    let result = bot.set_chat_title(
        chat_id,
        title
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.set_custom_emoji_sticker_set_thumbnail()
async → bool +opts

Use this method to set the thumbnail of a custom emoji sticker set. Returns True on success.

nameparams
FieldTypeDescription
custom_emoji_idOption<String>Custom emoji identifier of a sticker from the sticker set; pass an empty string to drop the thumbnail and use the first sticker as the thumbnail.
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{SetCustomEmojiStickerSetThumbnailParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let name = "my_name";
    // Optional parameters
    let params = SetCustomEmojiStickerSetThumbnailParams::new()
        .custom_emoji_id(None);


    let result = bot.set_custom_emoji_sticker_set_thumbnail(
        name,
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.set_game_score()
async → serde_json::Value +opts

Use this method to set the score of the specified user in a game message. On success, if the message is not an inline message, the Message is returned, otherwise True is returned. Returns an error, if the new score is not greater than the user's current score in the chat and force is False.

user_idscoreparams
FieldTypeDescription
forceOption<bool>Pass True if the high score is allowed to decrease. This can be useful when fixing mistakes or banning cheaters
disable_edit_messageOption<bool>Pass True if the game message should not be automatically edited to include the current scoreboard
chat_idOption<i64>Required if inline_message_id is not specified. Unique identifier for the target chat
message_idOption<i64>Required if inline_message_id is not specified. Identifier of the sent message
inline_message_idOption<String>Required if chat_id and message_id are not specified. Identifier of the inline message
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{SetGameScoreParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let user_id = 123456789i64;
    let score = 0i64;
    // Optional parameters
    let params = SetGameScoreParams::new()
        .force(None)
        .disable_edit_message(None)
        .chat_id(None)
        .message_id(None)
        .inline_message_id(None);


    let result = bot.set_game_score(
        user_id,
        score,
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.set_message_reaction()
async → bool +opts

Use this method to change the chosen reactions on a message. Service messages of some types can't be reacted to. Automatically forwarded messages from a channel to its discussion group have the same available reactions as messages in the channel. Bots can't use paid reactions. Returns True on success.

chat_idmessage_idparams
FieldTypeDescription
reactionOption<Vec<ReactionType>>A JSON-serialized list of reaction types to set on the message. Currently, as non-premium users, bots can set up to one reaction per message. A custom emoji reaction can be used if it is either already present on the message or explicitly allowed by chat administrators. Paid reactions can't be used by bots.
is_bigOption<bool>Pass True to set the reaction with a big animation
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{SetMessageReactionParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let chat_id = 123456789i64;
    let message_id = 0i64;
    // Optional parameters
    let params = SetMessageReactionParams::new()
        .reaction(None)
        .is_big(None);


    let result = bot.set_message_reaction(
        chat_id,
        message_id,
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.set_my_commands()
async → bool +opts

Use this method to change the list of the bot's commands. See this manual for more details about bot commands. Returns True on success.

commandsparams
FieldTypeDescription
scopeOption<Box<BotCommandScope>>A JSON-serialized object, describing scope of users for which the commands are relevant. Defaults to BotCommandScopeDefault.
language_codeOption<String>A two-letter ISO 639-1 language code. If empty, commands will be applied to all users from the given scope, for whose language there are no dedicated commands
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{SetMyCommandsParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let commands = vec![]  // Vec<BotCommand>;
    // Optional parameters
    let params = SetMyCommandsParams::new()
        .scope(None)
        .language_code(None);


    let result = bot.set_my_commands(
        commands,
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.set_my_default_administrator_rights()
async → bool +opts

Use this method to change the default administrator rights requested by the bot when it's added as an administrator to groups or channels. These rights will be suggested to users, but they are free to modify the list before adding the bot. Returns True on success.

params
FieldTypeDescription
rightsOption<Box<ChatAdministratorRights>>A JSON-serialized object describing new default administrator rights. If not specified, the default administrator rights will be cleared.
for_channelsOption<bool>Pass True to change the default administrator rights of the bot in channels. Otherwise, the default administrator rights of the bot for groups and supergroups will be changed.
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{SetMyDefaultAdministratorRightsParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    // Optional parameters
    let params = SetMyDefaultAdministratorRightsParams::new()
        .rights(None)
        .for_channels(None);


    let result = bot.set_my_default_administrator_rights(
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.set_my_description()
async → bool +opts

Use this method to change the bot's description, which is shown in the chat with the bot if the chat is empty. Returns True on success.

params
FieldTypeDescription
descriptionOption<String>New bot description; 0-512 characters. Pass an empty string to remove the dedicated description for the given language.
language_codeOption<String>A two-letter ISO 639-1 language code. If empty, the description will be applied to all users for whose language there is no dedicated description.
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{SetMyDescriptionParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    // Optional parameters
    let params = SetMyDescriptionParams::new()
        .description(None)
        .language_code(None);


    let result = bot.set_my_description(
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.set_my_name()
async → bool +opts

Use this method to change the bot's name. Returns True on success.

params
FieldTypeDescription
nameOption<String>New bot name; 0-64 characters. Pass an empty string to remove the dedicated name for the given language.
language_codeOption<String>A two-letter ISO 639-1 language code. If empty, the name will be shown to all users for whose language there is no dedicated name.
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{SetMyNameParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    // Optional parameters
    let params = SetMyNameParams::new()
        .name(None)
        .language_code(None);


    let result = bot.set_my_name(
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.set_my_profile_photo()
async → bool

Changes the profile photo of the bot. Returns True on success.

photo
🔗
use tgbotrs::{Bot, BotError};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let photo = InputProfilePhoto::default();

    let result = bot.set_my_profile_photo(
        photo
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.set_my_short_description()
async → bool +opts

Use this method to change the bot's short description, which is shown on the bot's profile page and is sent together with the link when users share the bot. Returns True on success.

params
FieldTypeDescription
short_descriptionOption<String>New short description for the bot; 0-120 characters. Pass an empty string to remove the dedicated short description for the given language.
language_codeOption<String>A two-letter ISO 639-1 language code. If empty, the short description will be applied to all users for whose language there is no dedicated short description.
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{SetMyShortDescriptionParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    // Optional parameters
    let params = SetMyShortDescriptionParams::new()
        .short_description(None)
        .language_code(None);


    let result = bot.set_my_short_description(
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.set_passport_data_errors()
async → bool

Informs a user that some of the Telegram Passport elements they provided contains errors. The user will not be able to re-submit their Passport to you until the errors are fixed (the contents of the field for which you returned the error must change). Returns True on success. /// Use this if the data submitted by the user doesn't satisfy the standards your service requires for any reason. For example, if a birthday date seems invalid, a submitted document is blurry, a scan shows evidence of tampering, etc. Supply some details in the error message to make sure the user knows how to correct the issues.

user_iderrors
🔗
use tgbotrs::{Bot, BotError};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let user_id = 123456789i64;
    let errors = vec![]  // Vec<PassportElementError>;

    let result = bot.set_passport_data_errors(
        user_id,
        errors
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.set_sticker_emoji_list()
async → bool

Use this method to change the list of emoji assigned to a regular or custom emoji sticker. The sticker must belong to a sticker set created by the bot. Returns True on success.

stickeremoji_list
🔗
use tgbotrs::{Bot, BotError};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let sticker = "example";
    let emoji_list = vec![]  // Vec<String>;

    let result = bot.set_sticker_emoji_list(
        sticker,
        emoji_list
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.set_sticker_keywords()
async → bool +opts

Use this method to change search keywords assigned to a regular or custom emoji sticker. The sticker must belong to a sticker set created by the bot. Returns True on success.

stickerparams
FieldTypeDescription
keywordsOption<Vec<String>>A JSON-serialized list of 0-20 search keywords for the sticker with total length of up to 64 characters
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{SetStickerKeywordsParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let sticker = "example";
    // Optional parameters
    let params = SetStickerKeywordsParams::new()
        .keywords(None);


    let result = bot.set_sticker_keywords(
        sticker,
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.set_sticker_mask_position()
async → bool +opts

Use this method to change the mask position of a mask sticker. The sticker must belong to a sticker set that was created by the bot. Returns True on success.

stickerparams
FieldTypeDescription
mask_positionOption<Box<MaskPosition>>A JSON-serialized object with the position where the mask should be placed on faces. Omit the parameter to remove the mask position.
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{SetStickerMaskPositionParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let sticker = "example";
    // Optional parameters
    let params = SetStickerMaskPositionParams::new()
        .mask_position(None);


    let result = bot.set_sticker_mask_position(
        sticker,
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.set_sticker_position_in_set()
async → bool

Use this method to move a sticker in a set created by the bot to a specific position. Returns True on success.

stickerposition
🔗
use tgbotrs::{Bot, BotError};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let sticker = "example";
    let position = 0i64;

    let result = bot.set_sticker_position_in_set(
        sticker,
        position
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.set_sticker_set_thumbnail()
async → bool +opts

Use this method to set the thumbnail of a regular or mask sticker set. The format of the thumbnail file must match the format of the stickers in the set. Returns True on success.

nameuser_idformatparams
FieldTypeDescription
thumbnailOption<InputFileOrString>A .WEBP or .PNG image with the thumbnail, must be up to 128 kilobytes in size and have a width and height of exactly 100px, or a .TGS animation with a thumbnail up to 32 kilobytes in size (see https://core.telegram.org/stickers#animation-requirements for animated sticker technical requirements), or a .WEBM video with the thumbnail up to 32 kilobytes in size; see https://core.telegram.org/stickers#video-requirements for video sticker technical requirements. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. More information on Sending Files: https://core.telegram.org/bots/api#sending-files. Animated and video sticker set thumbnails can't be uploaded via HTTP URL. If omitted, then the thumbnail is dropped and the first sticker is used as the thumbnail.
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{SetStickerSetThumbnailParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let name = "my_name";
    let user_id = 123456789i64;
    let format = "example";
    // Optional parameters
    let params = SetStickerSetThumbnailParams::new()
        .thumbnail(None);


    let result = bot.set_sticker_set_thumbnail(
        name,
        user_id,
        format,
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.set_sticker_set_title()
async → bool

Use this method to set the title of a created sticker set. Returns True on success.

nametitle
🔗
use tgbotrs::{Bot, BotError};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let name = "my_name";
    let title = "example";

    let result = bot.set_sticker_set_title(
        name,
        title
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.set_user_emoji_status()
async → bool +opts

Changes the emoji status for a given user that previously allowed the bot to manage their emoji status via the Mini App method requestEmojiStatusAccess. Returns True on success.

user_idparams
FieldTypeDescription
emoji_status_custom_emoji_idOption<String>Custom emoji identifier of the emoji status to set. Pass an empty string to remove the status.
emoji_status_expiration_dateOption<i64>Expiration date of the emoji status, if any
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{SetUserEmojiStatusParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let user_id = 123456789i64;
    // Optional parameters
    let params = SetUserEmojiStatusParams::new()
        .emoji_status_custom_emoji_id(None)
        .emoji_status_expiration_date(None);


    let result = bot.set_user_emoji_status(
        user_id,
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.set_webhook()
async → bool +opts

Use this method to specify a URL and receive incoming updates via an outgoing webhook. Whenever there is an update for the bot, we will send an HTTPS POST request to the specified URL, containing a JSON-serialized Update. In case of an unsuccessful request (a request with response HTTP status code different from 2XY), we will repeat the request and give up after a reasonable amount of attempts. Returns True on success. /// If you'd like to make sure that the webhook was set by you, you can specify secret data in the parameter secret_token. If specified, the request will contain a header "X-Telegram-Bot-Api-Secret-Token" with the secret token as content.

urlparams
FieldTypeDescription
certificateOption<InputFile>Upload your public key certificate so that the root certificate in use can be checked. See our self-signed guide for details.
ip_addressOption<String>The fixed IP address which will be used to send webhook requests instead of the IP address resolved through DNS
max_connectionsOption<i64>The maximum allowed number of simultaneous HTTPS connections to the webhook for update delivery, 1-100. Defaults to 40. Use lower values to limit the load on your bot's server, and higher values to increase your bot's throughput.
allowed_updatesOption<Vec<String>>A JSON-serialized list of the update types you want your bot to receive. For example, specify ["message", "edited_channel_post", "callback_query"] to only receive updates of these types. See Update for a complete list of available update types. Specify an empty list to receive all update types except chat_member, message_reaction, and message_reaction_count (default). If not specified, the previous setting will be used. Please note that this parameter doesn't affect updates created before the call to the setWebhook, so unwanted updates may be received for a short period of time.
drop_pending_updatesOption<bool>Pass True to drop all pending updates
secret_tokenOption<String>A secret token to be sent in a header "X-Telegram-Bot-Api-Secret-Token" in every webhook request, 1-256 characters. Only characters A-Z, a-z, 0-9, _ and - are allowed. The header is useful to ensure that the request comes from a webhook set by you.
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{SetWebhookParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let url = "https://example.com";
    // Optional parameters
    let params = SetWebhookParams::new()
        .certificate(None)
        .ip_address(None)
        .max_connections(None)
        .allowed_updates(None)
        .drop_pending_updates(None)
        // ... +1 more optional fields;


    let result = bot.set_webhook(
        url,
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}

Updates & Webhook

1
bot.close()
async → bool

Use this method to close the bot instance before moving it from one local server to another. You need to delete the webhook before calling this method to ensure that the bot isn't launched again after server restart. The method will return error 429 in the first 10 minutes after the bot is launched. Returns True on success. Requires no parameters.

no parameters
🔗
use tgbotrs::{Bot, BotError};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;


    let result = bot.close().await?;
    println!("Result: {result:?}");
    Ok(())
}

Stickers

3
bot.add_sticker_to_set()
async → bool

Use this method to add a new sticker to a set created by the bot. Emoji sticker sets can have up to 200 stickers. Other sticker sets can have up to 120 stickers. Returns True on success.

user_idnamesticker
🔗
use tgbotrs::{Bot, BotError};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let user_id = 123456789i64;
    let name = "my_name";
    let sticker = InputSticker::default();

    let result = bot.add_sticker_to_set(
        user_id,
        name,
        sticker
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.replace_sticker_in_set()
async → bool

Use this method to replace an existing sticker in a sticker set with a new one. The method is equivalent to calling deleteStickerFromSet, then addStickerToSet, then setStickerPositionInSet. Returns True on success.

user_idnameold_stickersticker
🔗
use tgbotrs::{Bot, BotError};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let user_id = 123456789i64;
    let name = "my_name";
    let old_sticker = "example";
    let sticker = InputSticker::default();

    let result = bot.replace_sticker_in_set(
        user_id,
        name,
        old_sticker,
        sticker
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.upload_sticker_file()
async → File

Use this method to upload a file with a sticker for later use in the createNewStickerSet, addStickerToSet, or replaceStickerInSet methods (the file can be used multiple times). Returns the uploaded File on success.

user_idstickersticker_format
🔗
use tgbotrs::{Bot, BotError};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let user_id = 123456789i64;
    let sticker = InputFile::default();
    let sticker_format = "example";

    let result = bot.upload_sticker_file(
        user_id,
        sticker,
        sticker_format
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}

Forum Topics

6
bot.close_forum_topic()
async → bool

Use this method to close an open topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights, unless it is the creator of the topic. Returns True on success.

chat_idmessage_thread_id
🔗
use tgbotrs::{Bot, BotError};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let chat_id = 123456789i64;
    let message_thread_id = 0i64;

    let result = bot.close_forum_topic(
        chat_id,
        message_thread_id
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.close_general_forum_topic()
async → bool

Use this method to close an open 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. Returns True on success.

chat_id
🔗
use tgbotrs::{Bot, BotError};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let chat_id = 123456789i64;

    let result = bot.close_general_forum_topic(
        chat_id
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.hide_general_forum_topic()
async → bool

Use this method to hide the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. The topic will be automatically closed if it was open. Returns True on success.

chat_id
🔗
use tgbotrs::{Bot, BotError};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let chat_id = 123456789i64;

    let result = bot.hide_general_forum_topic(
        chat_id
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.reopen_forum_topic()
async → bool

Use this method to reopen a closed topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights, unless it is the creator of the topic. Returns True on success.

chat_idmessage_thread_id
🔗
use tgbotrs::{Bot, BotError};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let chat_id = 123456789i64;
    let message_thread_id = 0i64;

    let result = bot.reopen_forum_topic(
        chat_id,
        message_thread_id
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.reopen_general_forum_topic()
async → bool

Use this method to reopen a closed 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. The topic will be automatically unhidden if it was hidden. Returns True on success.

chat_id
🔗
use tgbotrs::{Bot, BotError};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let chat_id = 123456789i64;

    let result = bot.reopen_general_forum_topic(
        chat_id
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.unhide_general_forum_topic()
async → bool

Use this method to unhide the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. Returns True on success.

chat_id
🔗
use tgbotrs::{Bot, BotError};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let chat_id = 123456789i64;

    let result = bot.unhide_general_forum_topic(
        chat_id
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}

Payments & Stars

6
bot.convert_gift_to_stars()
async → bool

Converts a given regular gift to Telegram Stars. Requires the can_convert_gifts_to_stars business bot right. Returns True on success.

business_connection_idowned_gift_id
🔗
use tgbotrs::{Bot, BotError};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let business_connection_id = "example";
    let owned_gift_id = "example";

    let result = bot.convert_gift_to_stars(
        business_connection_id,
        owned_gift_id
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.gift_premium_subscription()
async → bool +opts

Gifts a Telegram Premium subscription to the given user. Returns True on success.

user_idmonth_countstar_countparams
FieldTypeDescription
textOption<String>Text that will be shown along with the service message about the subscription; 0-128 characters
text_parse_modeOption<String>Mode for parsing entities in the text. See formatting options for more details. Entities other than "bold", "italic", "underline", "strikethrough", "spoiler", and "custom_emoji" are ignored.
text_entitiesOption<Vec<MessageEntity>>A JSON-serialized list of special entities that appear in the gift text. It can be specified instead of text_parse_mode. Entities other than "bold", "italic", "underline", "strikethrough", "spoiler", and "custom_emoji" are ignored.
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{GiftPremiumSubscriptionParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let user_id = 123456789i64;
    let month_count = 0i64;
    let star_count = 0i64;
    // Optional parameters
    let params = GiftPremiumSubscriptionParams::new()
        .text(None)
        .text_parse_mode(None)
        .text_entities(None);


    let result = bot.gift_premium_subscription(
        user_id,
        month_count,
        star_count,
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.refund_star_payment()
async → bool

Refunds a successful payment in Telegram Stars. Returns True on success.

user_idtelegram_payment_charge_id
🔗
use tgbotrs::{Bot, BotError};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let user_id = 123456789i64;
    let telegram_payment_charge_id = "example";

    let result = bot.refund_star_payment(
        user_id,
        telegram_payment_charge_id
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.transfer_business_account_stars()
async → bool

Transfers Telegram Stars from the business account balance to the bot's balance. Requires the can_transfer_stars business bot right. Returns True on success.

business_connection_idstar_count
🔗
use tgbotrs::{Bot, BotError};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let business_connection_id = "example";
    let star_count = 0i64;

    let result = bot.transfer_business_account_stars(
        business_connection_id,
        star_count
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.transfer_gift()
async → bool +opts

Transfers an owned unique gift to another user. Requires the can_transfer_and_upgrade_gifts business bot right. Requires can_transfer_stars business bot right if the transfer is paid. Returns True on success.

business_connection_idowned_gift_idnew_owner_chat_idparams
FieldTypeDescription
star_countOption<i64>The amount of Telegram Stars that will be paid for the transfer from the business account balance. If positive, then the can_transfer_stars business bot right is required.
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{TransferGiftParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let business_connection_id = "example";
    let owned_gift_id = "example";
    let new_owner_chat_id = 123456789i64;
    // Optional parameters
    let params = TransferGiftParams::new()
        .star_count(None);


    let result = bot.transfer_gift(
        business_connection_id,
        owned_gift_id,
        new_owner_chat_id,
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.upgrade_gift()
async → bool +opts

Upgrades a given regular gift to a unique gift. Requires the can_transfer_and_upgrade_gifts business bot right. Additionally requires the can_transfer_stars business bot right if the upgrade is paid. Returns True on success.

business_connection_idowned_gift_idparams
FieldTypeDescription
keep_original_detailsOption<bool>Pass True to keep the original gift text, sender and receiver in the upgraded gift
star_countOption<i64>The amount of Telegram Stars that will be paid for the upgrade from the business account balance. If gift.prepaid_upgrade_star_count > 0, then pass 0, otherwise, the can_transfer_stars business bot right is required and gift.upgrade_star_count must be passed.
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{UpgradeGiftParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let business_connection_id = "example";
    let owned_gift_id = "example";
    // Optional parameters
    let params = UpgradeGiftParams::new()
        .keep_original_details(None)
        .star_count(None);


    let result = bot.upgrade_gift(
        business_connection_id,
        owned_gift_id,
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}

Stories

2
bot.post_story()
async → Story +opts

Posts a story on behalf of a managed business account. Requires the can_manage_stories business bot right. Returns Story on success.

business_connection_idcontentactive_periodparams
FieldTypeDescription
captionOption<String>Caption of the story, 0-2048 characters after entities parsing
parse_modeOption<String>Mode for parsing entities in the story caption. See formatting options for more details.
caption_entitiesOption<Vec<MessageEntity>>A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode
areasOption<Vec<StoryArea>>A JSON-serialized list of clickable areas to be shown on the story
post_to_chat_pageOption<bool>Pass True to keep the story accessible after it expires
protect_contentOption<bool>Pass True if the content of the story must be protected from forwarding and screenshotting
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{PostStoryParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let business_connection_id = "example";
    let content = InputStoryContent::default();
    let active_period = 0i64;
    // Optional parameters
    let params = PostStoryParams::new()
        .caption(None)
        .parse_mode(None)
        .caption_entities(None)
        .areas(None)
        .post_to_chat_page(None)
        // ... +1 more optional fields;


    let result = bot.post_story(
        business_connection_id,
        content,
        active_period,
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.repost_story()
async → Story +opts

Reposts a story on behalf of a business account from another business account. Both business accounts must be managed by the same bot, and the story on the source account must have been posted (or reposted) by the bot. Requires the can_manage_stories business bot right for both business accounts. Returns Story on success.

business_connection_idfrom_chat_idfrom_story_idactive_periodparams
FieldTypeDescription
post_to_chat_pageOption<bool>Pass True to keep the story accessible after it expires
protect_contentOption<bool>Pass True if the content of the story must be protected from forwarding and screenshotting
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{RepostStoryParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let business_connection_id = "example";
    let from_chat_id = 123456789i64;
    let from_story_id = 0i64;
    let active_period = 0i64;
    // Optional parameters
    let params = RepostStoryParams::new()
        .post_to_chat_page(None)
        .protect_content(None);


    let result = bot.repost_story(
        business_connection_id,
        from_chat_id,
        from_story_id,
        active_period,
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}

Business

2
bot.read_business_message()
async → bool

Marks incoming message as read on behalf of a business account. Requires the can_read_messages business bot right. Returns True on success.

business_connection_idchat_idmessage_id
🔗
use tgbotrs::{Bot, BotError};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let business_connection_id = "example";
    let chat_id = 123456789i64;
    let message_id = 0i64;

    let result = bot.read_business_message(
        business_connection_id,
        chat_id,
        message_id
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.remove_business_account_profile_photo()
async → bool +opts

Removes the current profile photo of a managed business account. Requires the can_edit_profile_photo business bot right. Returns True on success.

business_connection_idparams
FieldTypeDescription
is_publicOption<bool>Pass True to remove the public photo, which is visible even if the main photo is hidden by the business account's privacy settings. After the main photo is removed, the previous profile photo (if present) becomes the main photo.
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{RemoveBusinessAccountProfilePhotoParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let business_connection_id = "example";
    // Optional parameters
    let params = RemoveBusinessAccountProfilePhotoParams::new()
        .is_public(None);


    let result = bot.remove_business_account_profile_photo(
        business_connection_id,
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}

Other

11
bot.leave_chat()
async → bool

Use this method for your bot to leave a group, supergroup or channel. Returns True on success.

chat_id
🔗
use tgbotrs::{Bot, BotError};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let chat_id = 123456789i64;

    let result = bot.leave_chat(
        chat_id
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.log_out()
async → bool

Use this method to log out from the cloud Bot API server before launching the bot locally. You must log out the bot before running it locally, otherwise there is no guarantee that the bot will receive updates. After a successful call, you can immediately log in on a local server, but will not be able to log in back to the cloud Bot API server for 10 minutes. Returns True on success. Requires no parameters.

no parameters
🔗
use tgbotrs::{Bot, BotError};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;


    let result = bot.log_out().await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.remove_chat_verification()
async → bool

Removes verification from a chat that is currently verified on behalf of the organization represented by the bot. Returns True on success.

chat_id
🔗
use tgbotrs::{Bot, BotError};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let chat_id = 123456789i64;

    let result = bot.remove_chat_verification(
        chat_id
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.remove_my_profile_photo()
async → bool

Removes the profile photo of the bot. Requires no parameters. Returns True on success.

no parameters
🔗
use tgbotrs::{Bot, BotError};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;


    let result = bot.remove_my_profile_photo().await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.remove_user_verification()
async → bool

Removes verification from a user who is currently verified on behalf of the organization represented by the bot. Returns True on success.

user_id
🔗
use tgbotrs::{Bot, BotError};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let user_id = 123456789i64;

    let result = bot.remove_user_verification(
        user_id
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.save_prepared_inline_message()
async → PreparedInlineMessage +opts

Stores a message that can be sent by a user of a Mini App. Returns a PreparedInlineMessage object.

user_idresultparams
FieldTypeDescription
allow_user_chatsOption<bool>Pass True if the message can be sent to private chats with users
allow_bot_chatsOption<bool>Pass True if the message can be sent to private chats with bots
allow_group_chatsOption<bool>Pass True if the message can be sent to group and supergroup chats
allow_channel_chatsOption<bool>Pass True if the message can be sent to channel chats
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{SavePreparedInlineMessageParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let user_id = 123456789i64;
    let result = InlineQueryResult::default();
    // Optional parameters
    let params = SavePreparedInlineMessageParams::new()
        .allow_user_chats(None)
        .allow_bot_chats(None)
        .allow_group_chats(None)
        .allow_channel_chats(None);


    let result = bot.save_prepared_inline_message(
        user_id,
        result,
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.stop_message_live_location()
async → serde_json::Value +opts

Use this method to stop updating a live location message before live_period expires. On success, if the message is not an inline message, the edited Message is returned, otherwise True is returned.

params
FieldTypeDescription
business_connection_idOption<String>Unique identifier of the business connection on behalf of which the message to be edited was sent
chat_idOption<ChatId>Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
message_idOption<i64>Required if inline_message_id is not specified. Identifier of the message with live location to stop
inline_message_idOption<String>Required if chat_id and message_id are not specified. Identifier of the inline message
reply_markupOption<Box<InlineKeyboardMarkup>>A JSON-serialized object for a new inline keyboard.
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{StopMessageLiveLocationParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    // Optional parameters
    let params = StopMessageLiveLocationParams::new()
        .business_connection_id(None)
        .chat_id(None)
        .message_id(None)
        .inline_message_id(None)
        .reply_markup(None);


    let result = bot.stop_message_live_location(
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.stop_poll()
async → Poll +opts

Use this method to stop a poll which was sent by the bot. On success, the stopped Poll is returned.

chat_idmessage_idparams
FieldTypeDescription
business_connection_idOption<String>Unique identifier of the business connection on behalf of which the message to be edited was sent
reply_markupOption<Box<InlineKeyboardMarkup>>A JSON-serialized object for a new message inline keyboard.
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{StopPollParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let chat_id = 123456789i64;
    let message_id = 0i64;
    // Optional parameters
    let params = StopPollParams::new()
        .business_connection_id(None)
        .reply_markup(None);


    let result = bot.stop_poll(
        chat_id,
        message_id,
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.verify_chat()
async → bool +opts

Verifies a chat on behalf of the organization which is represented by the bot. Returns True on success.

chat_idparams
FieldTypeDescription
custom_descriptionOption<String>Custom description for the verification; 0-70 characters. Must be empty if the organization isn't allowed to provide a custom verification description.
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{VerifyChatParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let chat_id = 123456789i64;
    // Optional parameters
    let params = VerifyChatParams::new()
        .custom_description(None);


    let result = bot.verify_chat(
        chat_id,
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}
bot.verify_user()
async → bool +opts

Verifies a user on behalf of the organization which is represented by the bot. Returns True on success.

user_idparams
FieldTypeDescription
custom_descriptionOption<String>Custom description for the verification; 0-70 characters. Must be empty if the organization isn't allowed to provide a custom verification description.
🔗
use tgbotrs::{Bot, BotError};
use tgbotrs::gen_methods::{VerifyUserParams};

#[tokio::main]
async fn main() -> Result<(), BotError> {
    let bot = Bot::new("YOUR_BOT_TOKEN").await?;

    let user_id = 123456789i64;
    // Optional parameters
    let params = VerifyUserParams::new()
        .custom_description(None);


    let result = bot.verify_user(
        user_id,
        Some(params)
    ).await?;
    println!("Result: {result:?}");
    Ok(())
}

📐 Types Reference

All 257 Telegram types — every field shown. See docs.rs for full rustdoc.

AcceptedGiftTypes 5
unlimited_giftsbool
limited_giftsbool
unique_giftsbool
premium_subscriptionbool
gifts_from_channelsbool
AffiliateInfo 5
affiliate_userOption<Box<User>>
affiliate_chatOption<Box<Chat>>
commission_per_millei64
amounti64
nanostar_amountOption<i64>
Animation 9
file_idString
file_unique_idString
widthi64
heighti64
durationi64
thumbnailOption<Box<PhotoSize>>
file_nameOption<String>
mime_typeOption<String>
file_sizeOption<i64>
Audio 9
file_idString
file_unique_idString
durationi64
performerOption<String>
titleOption<String>
file_nameOption<String>
mime_typeOption<String>
file_sizeOption<i64>
thumbnailOption<Box<PhotoSize>>
BackgroundFillFreeformGradient 1
colorsVec<i64>
BackgroundFillGradient 3
top_colori64
bottom_colori64
rotation_anglei64
BackgroundFillSolid 1
colori64
BackgroundTypeChatTheme 1
theme_nameString
BackgroundTypeFill 2
fillBackgroundFill
dark_theme_dimmingi64
BackgroundTypePattern 5
documentDocument
fillBackgroundFill
intensityi64
is_invertedOption<bool>
is_movingOption<bool>
BackgroundTypeWallpaper 4
documentDocument
dark_theme_dimmingi64
is_blurredOption<bool>
is_movingOption<bool>
Birthdate 3
dayi64
monthi64
yearOption<i64>
BotCommand 2
commandString
descriptionString
BotCommandScopeAllChatAdministrators 0
no public fields
BotCommandScopeAllGroupChats 0
no public fields
BotCommandScopeAllPrivateChats 0
no public fields
BotCommandScopeChat 1
chat_idChatId
BotCommandScopeChatAdministrators 1
chat_idChatId
BotCommandScopeChatMember 2
chat_idChatId
user_idi64
BotCommandScopeDefault 0
no public fields
BotDescription 1
descriptionString
BotName 1
nameString
BotShortDescription 1
short_descriptionString
BusinessBotRights 14
can_replyOption<bool>
can_read_messagesOption<bool>
can_delete_sent_messagesOption<bool>
can_delete_all_messagesOption<bool>
can_edit_nameOption<bool>
can_edit_bioOption<bool>
can_edit_profile_photoOption<bool>
can_edit_usernameOption<bool>
can_change_gift_settingsOption<bool>
can_view_gifts_and_starsOption<bool>
can_convert_gifts_to_starsOption<bool>
can_transfer_and_upgrade_giftsOption<bool>
can_transfer_starsOption<bool>
can_manage_storiesOption<bool>
BusinessConnection 6
idString
userUser
user_chat_idi64
datei64
rightsOption<Box<BusinessBotRights>>
is_enabledbool
BusinessIntro 3
titleOption<String>
messageOption<String>
stickerOption<Box<Sticker>>
BusinessLocation 2
addressString
locationOption<Box<Location>>
BusinessMessagesDeleted 3
business_connection_idString
chatChat
message_idsVec<i64>
BusinessOpeningHours 2
time_zone_nameString
opening_hoursVec<BusinessOpeningHoursInterval>
BusinessOpeningHoursInterval 2
opening_minutei64
closing_minutei64
CallbackQuery 7
idString
fromUser
messageOption<Box<MaybeInaccessibleMessage>>
inline_message_idOption<String>
chat_instanceString
dataOption<String>
game_short_nameOption<String>
Chat 7
idi64
titleOption<String>
usernameOption<String>
first_nameOption<String>
last_nameOption<String>
is_forumOption<bool>
is_direct_messagesOption<bool>
ChatAdministratorRights 16
is_anonymousbool
can_manage_chatbool
can_delete_messagesbool
can_manage_video_chatsbool
can_restrict_membersbool
can_promote_membersbool
can_change_infobool
can_invite_usersbool
can_post_storiesbool
can_edit_storiesbool
can_delete_storiesbool
can_post_messagesOption<bool>
can_edit_messagesOption<bool>
can_pin_messagesOption<bool>
can_manage_topicsOption<bool>
can_manage_direct_messagesOption<bool>
ChatBackground 0
no public fields
ChatBoost 4
boost_idString
add_datei64
expiration_datei64
sourceChatBoostSource
ChatBoostAdded 1
boost_counti64
ChatBoostRemoved 4
chatChat
boost_idString
remove_datei64
sourceChatBoostSource
ChatBoostSourceGiftCode 2
sourceString
userUser
ChatBoostSourceGiveaway 5
sourceString
giveaway_message_idi64
userOption<Box<User>>
prize_star_countOption<i64>
is_unclaimedOption<bool>
ChatBoostSourcePremium 2
sourceString
userUser
ChatBoostUpdated 2
chatChat
boostChatBoost
ChatFullInfo 50
idi64
titleOption<String>
usernameOption<String>
first_nameOption<String>
last_nameOption<String>
is_forumOption<bool>
is_direct_messagesOption<bool>
accent_color_idi64
max_reaction_counti64
photoOption<Box<ChatPhoto>>
active_usernamesOption<Vec<String>>
birthdateOption<Box<Birthdate>>
business_introOption<Box<BusinessIntro>>
business_locationOption<Box<BusinessLocation>>
business_opening_hoursOption<Box<BusinessOpeningHours>>
personal_chatOption<Box<Chat>>
parent_chatOption<Box<Chat>>
available_reactionsOption<Vec<ReactionType>>
background_custom_emoji_idOption<String>
profile_accent_color_idOption<i64>
profile_background_custom_emoji_idOption<String>
emoji_status_custom_emoji_idOption<String>
emoji_status_expiration_dateOption<i64>
bioOption<String>
has_private_forwardsOption<bool>
has_restricted_voice_and_video_messagesOption<bool>
join_to_send_messagesOption<bool>
join_by_requestOption<bool>
descriptionOption<String>
invite_linkOption<String>
pinned_messageOption<Box<Message>>
permissionsOption<Box<ChatPermissions>>
accepted_gift_typesAcceptedGiftTypes
can_send_paid_mediaOption<bool>
slow_mode_delayOption<i64>
unrestrict_boost_countOption<i64>
message_auto_delete_timeOption<i64>
has_aggressive_anti_spam_enabledOption<bool>
has_hidden_membersOption<bool>
has_protected_contentOption<bool>
has_visible_historyOption<bool>
sticker_set_nameOption<String>
can_set_sticker_setOption<bool>
custom_emoji_sticker_set_nameOption<String>
linked_chat_idOption<i64>
locationOption<Box<ChatLocation>>
ratingOption<Box<UserRating>>
first_profile_audioOption<Box<Audio>>
unique_gift_colorsOption<Box<UniqueGiftColors>>
paid_message_star_countOption<i64>
ChatJoinRequest 6
chatChat
fromUser
user_chat_idi64
datei64
bioOption<String>
invite_linkOption<Box<ChatInviteLink>>
ChatLocation 2
locationLocation
addressString
ChatMemberAdministrator 20
statusString
userUser
can_be_editedbool
is_anonymousbool
can_manage_chatbool
can_delete_messagesbool
can_manage_video_chatsbool
can_restrict_membersbool
can_promote_membersbool
can_change_infobool
can_invite_usersbool
can_post_storiesbool
can_edit_storiesbool
can_delete_storiesbool
can_post_messagesOption<bool>
can_edit_messagesOption<bool>
can_pin_messagesOption<bool>
can_manage_topicsOption<bool>
can_manage_direct_messagesOption<bool>
custom_titleOption<String>
ChatMemberBanned 3
statusString
userUser
until_datei64
ChatMemberLeft 2
statusString
userUser
ChatMemberMember 3
statusString
userUser
until_dateOption<i64>
ChatMemberOwner 4
statusString
userUser
is_anonymousbool
custom_titleOption<String>
ChatMemberRestricted 18
statusString
userUser
is_memberbool
can_send_messagesbool
can_send_audiosbool
can_send_documentsbool
can_send_photosbool
can_send_videosbool
can_send_video_notesbool
can_send_voice_notesbool
can_send_pollsbool
can_send_other_messagesbool
can_add_web_page_previewsbool
can_change_infobool
can_invite_usersbool
can_pin_messagesbool
can_manage_topicsbool
until_datei64
ChatMemberUpdated 8
chatChat
fromUser
datei64
old_chat_memberChatMember
new_chat_memberChatMember
invite_linkOption<Box<ChatInviteLink>>
via_join_requestOption<bool>
via_chat_folder_invite_linkOption<bool>
ChatOwnerChanged 1
new_ownerUser
ChatOwnerLeft 1
new_ownerOption<Box<User>>
ChatPermissions 14
can_send_messagesOption<bool>
can_send_audiosOption<bool>
can_send_documentsOption<bool>
can_send_photosOption<bool>
can_send_videosOption<bool>
can_send_video_notesOption<bool>
can_send_voice_notesOption<bool>
can_send_pollsOption<bool>
can_send_other_messagesOption<bool>
can_add_web_page_previewsOption<bool>
can_change_infoOption<bool>
can_invite_usersOption<bool>
can_pin_messagesOption<bool>
can_manage_topicsOption<bool>
ChatPhoto 4
small_file_idString
small_file_unique_idString
big_file_idString
big_file_unique_idString
ChatShared 5
request_idi64
chat_idi64
titleOption<String>
usernameOption<String>
photoOption<Vec<PhotoSize>>
Checklist 5
titleString
title_entitiesOption<Vec<MessageEntity>>
tasksVec<ChecklistTask>
others_can_add_tasksOption<bool>
others_can_mark_tasks_as_doneOption<bool>
ChecklistTask 6
idi64
textString
text_entitiesOption<Vec<MessageEntity>>
completed_by_userOption<Box<User>>
completed_by_chatOption<Box<Chat>>
completion_dateOption<i64>
ChecklistTasksAdded 2
checklist_messageOption<Box<Message>>
tasksVec<ChecklistTask>
ChecklistTasksDone 3
checklist_messageOption<Box<Message>>
marked_as_done_task_idsOption<Vec<i64>>
marked_as_not_done_task_idsOption<Vec<i64>>
ChosenInlineResult 5
result_idString
fromUser
locationOption<Box<Location>>
inline_message_idOption<String>
queryString
Contact 5
phone_numberString
first_nameString
last_nameOption<String>
user_idOption<i64>
vcardOption<String>
CopyTextButton 1
textString
Dice 2
emojiString
valuei64
DirectMessagePriceChanged 2
are_direct_messages_enabledbool
direct_message_star_countOption<i64>
DirectMessagesTopic 2
topic_idi64
userOption<Box<User>>
Document 6
file_idString
file_unique_idString
thumbnailOption<Box<PhotoSize>>
file_nameOption<String>
mime_typeOption<String>
file_sizeOption<i64>
EncryptedCredentials 3
dataString
hashString
secretString
EncryptedPassportElement 9
dataOption<String>
phone_numberOption<String>
emailOption<String>
filesOption<Vec<PassportFile>>
front_sideOption<Box<PassportFile>>
reverse_sideOption<Box<PassportFile>>
selfieOption<Box<PassportFile>>
translationOption<Vec<PassportFile>>
hashString
ExternalReplyInfo 25
originMessageOrigin
chatOption<Box<Chat>>
message_idOption<i64>
link_preview_optionsOption<Box<LinkPreviewOptions>>
animationOption<Box<Animation>>
audioOption<Box<Audio>>
documentOption<Box<Document>>
paid_mediaOption<Box<PaidMediaInfo>>
photoOption<Vec<PhotoSize>>
stickerOption<Box<Sticker>>
storyOption<Box<Story>>
videoOption<Box<Video>>
video_noteOption<Box<VideoNote>>
voiceOption<Box<Voice>>
has_media_spoilerOption<bool>
checklistOption<Box<Checklist>>
contactOption<Box<Contact>>
diceOption<Box<Dice>>
gameOption<Box<Game>>
giveawayOption<Box<Giveaway>>
giveaway_winnersOption<Box<GiveawayWinners>>
invoiceOption<Box<Invoice>>
locationOption<Box<Location>>
pollOption<Box<Poll>>
venueOption<Box<Venue>>
File 4
file_idString
file_unique_idString
file_sizeOption<i64>
file_pathOption<String>
ForceReply 3
force_replybool
input_field_placeholderOption<String>
selectiveOption<bool>
ForumTopic 5
message_thread_idi64
nameString
icon_colori64
icon_custom_emoji_idOption<String>
is_name_implicitOption<bool>
ForumTopicCreated 4
nameString
icon_colori64
icon_custom_emoji_idOption<String>
is_name_implicitOption<bool>
ForumTopicEdited 2
nameOption<String>
icon_custom_emoji_idOption<String>
Game 6
titleString
descriptionString
photoVec<PhotoSize>
textOption<String>
text_entitiesOption<Vec<MessageEntity>>
animationOption<Box<Animation>>
GameHighScore 3
positioni64
userUser
scorei64
Gift 13
idString
stickerSticker
star_counti64
upgrade_star_countOption<i64>
is_premiumOption<bool>
has_colorsOption<bool>
total_countOption<i64>
remaining_countOption<i64>
personal_total_countOption<i64>
personal_remaining_countOption<i64>
backgroundOption<Box<GiftBackground>>
unique_gift_variant_countOption<i64>
publisher_chatOption<Box<Chat>>
GiftBackground 3
center_colori64
edge_colori64
text_colori64
GiftInfo 10
giftGift
owned_gift_idOption<String>
convert_star_countOption<i64>
prepaid_upgrade_star_countOption<i64>
is_upgrade_separateOption<bool>
can_be_upgradedOption<bool>
textOption<String>
entitiesOption<Vec<MessageEntity>>
is_privateOption<bool>
unique_gift_numberOption<i64>
Gifts 1
giftsVec<Gift>
Giveaway 9
chatsVec<Chat>
winners_selection_datei64
winner_counti64
only_new_membersOption<bool>
has_public_winnersOption<bool>
prize_descriptionOption<String>
country_codesOption<Vec<String>>
prize_star_countOption<i64>
premium_subscription_month_countOption<i64>
GiveawayCompleted 4
winner_counti64
unclaimed_prize_countOption<i64>
giveaway_messageOption<Box<Message>>
is_star_giveawayOption<bool>
GiveawayCreated 1
prize_star_countOption<i64>
GiveawayWinners 12
chatChat
giveaway_message_idi64
winners_selection_datei64
winner_counti64
winnersVec<User>
additional_chat_countOption<i64>
prize_star_countOption<i64>
premium_subscription_month_countOption<i64>
unclaimed_prize_countOption<i64>
only_new_membersOption<bool>
was_refundedOption<bool>
prize_descriptionOption<String>
InaccessibleMessage 3
chatChat
message_idi64
datei64
InlineKeyboardButton 13
textString
icon_custom_emoji_idOption<String>
styleOption<String>
urlOption<String>
callback_dataOption<String>
web_appOption<Box<WebAppInfo>>
login_urlOption<Box<LoginUrl>>
switch_inline_queryOption<String>
switch_inline_query_current_chatOption<String>
switch_inline_query_chosen_chatOption<Box<SwitchInlineQueryChosenChat>>
copy_textOption<Box<CopyTextButton>>
callback_gameOption<Box<CallbackGame>>
payOption<bool>
InlineKeyboardMarkup 1
inline_keyboardVec<Vec<InlineKeyboardButton>>
InlineQuery 6
idString
fromUser
queryString
offsetString
chat_typeOption<String>
locationOption<Box<Location>>
InlineQueryResultArticle 9
idString
titleString
input_message_contentInputMessageContent
reply_markupOption<Box<InlineKeyboardMarkup>>
urlOption<String>
descriptionOption<String>
thumbnail_urlOption<String>
thumbnail_widthOption<i64>
thumbnail_heightOption<i64>
InlineQueryResultAudio 10
idString
audio_urlString
titleString
captionOption<String>
parse_modeOption<String>
caption_entitiesOption<Vec<MessageEntity>>
performerOption<String>
audio_durationOption<i64>
reply_markupOption<Box<InlineKeyboardMarkup>>
input_message_contentOption<Box<InputMessageContent>>
InlineQueryResultCachedAudio 7
idString
audio_file_idString
captionOption<String>
parse_modeOption<String>
caption_entitiesOption<Vec<MessageEntity>>
reply_markupOption<Box<InlineKeyboardMarkup>>
input_message_contentOption<Box<InputMessageContent>>
InlineQueryResultCachedDocument 9
idString
titleString
document_file_idString
descriptionOption<String>
captionOption<String>
parse_modeOption<String>
caption_entitiesOption<Vec<MessageEntity>>
reply_markupOption<Box<InlineKeyboardMarkup>>
input_message_contentOption<Box<InputMessageContent>>
InlineQueryResultCachedGif 9
idString
gif_file_idString
titleOption<String>
captionOption<String>
parse_modeOption<String>
caption_entitiesOption<Vec<MessageEntity>>
show_caption_above_mediaOption<bool>
reply_markupOption<Box<InlineKeyboardMarkup>>
input_message_contentOption<Box<InputMessageContent>>
InlineQueryResultCachedMpeg4Gif 9
idString
mpeg4_file_idString
titleOption<String>
captionOption<String>
parse_modeOption<String>
caption_entitiesOption<Vec<MessageEntity>>
show_caption_above_mediaOption<bool>
reply_markupOption<Box<InlineKeyboardMarkup>>
input_message_contentOption<Box<InputMessageContent>>
InlineQueryResultCachedPhoto 10
idString
photo_file_idString
titleOption<String>
descriptionOption<String>
captionOption<String>
parse_modeOption<String>
caption_entitiesOption<Vec<MessageEntity>>
show_caption_above_mediaOption<bool>
reply_markupOption<Box<InlineKeyboardMarkup>>
input_message_contentOption<Box<InputMessageContent>>
InlineQueryResultCachedSticker 4
idString
sticker_file_idString
reply_markupOption<Box<InlineKeyboardMarkup>>
input_message_contentOption<Box<InputMessageContent>>
InlineQueryResultCachedVideo 10
idString
video_file_idString
titleString
descriptionOption<String>
captionOption<String>
parse_modeOption<String>
caption_entitiesOption<Vec<MessageEntity>>
show_caption_above_mediaOption<bool>
reply_markupOption<Box<InlineKeyboardMarkup>>
input_message_contentOption<Box<InputMessageContent>>
InlineQueryResultCachedVoice 8
idString
voice_file_idString
titleString
captionOption<String>
parse_modeOption<String>
caption_entitiesOption<Vec<MessageEntity>>
reply_markupOption<Box<InlineKeyboardMarkup>>
input_message_contentOption<Box<InputMessageContent>>
InlineQueryResultContact 10
idString
phone_numberString
first_nameString
last_nameOption<String>
vcardOption<String>
reply_markupOption<Box<InlineKeyboardMarkup>>
input_message_contentOption<Box<InputMessageContent>>
thumbnail_urlOption<String>
thumbnail_widthOption<i64>
thumbnail_heightOption<i64>
InlineQueryResultDocument 13
idString
titleString
captionOption<String>
parse_modeOption<String>
caption_entitiesOption<Vec<MessageEntity>>
document_urlString
mime_typeString
descriptionOption<String>
reply_markupOption<Box<InlineKeyboardMarkup>>
input_message_contentOption<Box<InputMessageContent>>
thumbnail_urlOption<String>
thumbnail_widthOption<i64>
thumbnail_heightOption<i64>
InlineQueryResultGame 3
idString
game_short_nameString
reply_markupOption<Box<InlineKeyboardMarkup>>
InlineQueryResultGif 14
idString
gif_urlString
gif_widthOption<i64>
gif_heightOption<i64>
gif_durationOption<i64>
thumbnail_urlString
thumbnail_mime_typeOption<String>
titleOption<String>
captionOption<String>
parse_modeOption<String>
caption_entitiesOption<Vec<MessageEntity>>
show_caption_above_mediaOption<bool>
reply_markupOption<Box<InlineKeyboardMarkup>>
input_message_contentOption<Box<InputMessageContent>>
InlineQueryResultLocation 13
idString
latitudef64
longitudef64
titleString
horizontal_accuracyOption<f64>
live_periodOption<i64>
headingOption<i64>
proximity_alert_radiusOption<i64>
reply_markupOption<Box<InlineKeyboardMarkup>>
input_message_contentOption<Box<InputMessageContent>>
thumbnail_urlOption<String>
thumbnail_widthOption<i64>
thumbnail_heightOption<i64>
InlineQueryResultMpeg4Gif 14
idString
mpeg4_urlString
mpeg4_widthOption<i64>
mpeg4_heightOption<i64>
mpeg4_durationOption<i64>
thumbnail_urlString
thumbnail_mime_typeOption<String>
titleOption<String>
captionOption<String>
parse_modeOption<String>
caption_entitiesOption<Vec<MessageEntity>>
show_caption_above_mediaOption<bool>
reply_markupOption<Box<InlineKeyboardMarkup>>
input_message_contentOption<Box<InputMessageContent>>
InlineQueryResultPhoto 13
idString
photo_urlString
thumbnail_urlString
photo_widthOption<i64>
photo_heightOption<i64>
titleOption<String>
descriptionOption<String>
captionOption<String>
parse_modeOption<String>
caption_entitiesOption<Vec<MessageEntity>>
show_caption_above_mediaOption<bool>
reply_markupOption<Box<InlineKeyboardMarkup>>
input_message_contentOption<Box<InputMessageContent>>
InlineQueryResultVenue 14
idString
latitudef64
longitudef64
titleString
addressString
foursquare_idOption<String>
foursquare_typeOption<String>
google_place_idOption<String>
google_place_typeOption<String>
reply_markupOption<Box<InlineKeyboardMarkup>>
input_message_contentOption<Box<InputMessageContent>>
thumbnail_urlOption<String>
thumbnail_widthOption<i64>
thumbnail_heightOption<i64>
InlineQueryResultVideo 15
idString
video_urlString
mime_typeString
thumbnail_urlString
titleString
captionOption<String>
parse_modeOption<String>
caption_entitiesOption<Vec<MessageEntity>>
show_caption_above_mediaOption<bool>
video_widthOption<i64>
video_heightOption<i64>
video_durationOption<i64>
descriptionOption<String>
reply_markupOption<Box<InlineKeyboardMarkup>>
input_message_contentOption<Box<InputMessageContent>>
InlineQueryResultVoice 9
idString
voice_urlString
titleString
captionOption<String>
parse_modeOption<String>
caption_entitiesOption<Vec<MessageEntity>>
voice_durationOption<i64>
reply_markupOption<Box<InlineKeyboardMarkup>>
input_message_contentOption<Box<InputMessageContent>>
InlineQueryResultsButton 3
textString
web_appOption<Box<WebAppInfo>>
start_parameterOption<String>
InputChecklist 6
titleString
parse_modeOption<String>
title_entitiesOption<Vec<MessageEntity>>
tasksVec<InputChecklistTask>
others_can_add_tasksOption<bool>
others_can_mark_tasks_as_doneOption<bool>
InputChecklistTask 4
idi64
textString
parse_modeOption<String>
text_entitiesOption<Vec<MessageEntity>>
InputContactMessageContent 4
phone_numberString
first_nameString
last_nameOption<String>
vcardOption<String>
InputInvoiceMessageContent 20
titleString
descriptionString
payloadString
provider_tokenOption<String>
currencyString
pricesVec<LabeledPrice>
max_tip_amountOption<i64>
suggested_tip_amountsOption<Vec<i64>>
provider_dataOption<String>
photo_urlOption<String>
photo_sizeOption<i64>
photo_widthOption<i64>
photo_heightOption<i64>
need_nameOption<bool>
need_phone_numberOption<bool>
need_emailOption<bool>
need_shipping_addressOption<bool>
send_phone_number_to_providerOption<bool>
send_email_to_providerOption<bool>
is_flexibleOption<bool>
InputLocationMessageContent 6
latitudef64
longitudef64
horizontal_accuracyOption<f64>
live_periodOption<i64>
headingOption<i64>
proximity_alert_radiusOption<i64>
InputMediaAnimation 10
mediaString
thumbnailOption<String>
captionOption<String>
parse_modeOption<String>
caption_entitiesOption<Vec<MessageEntity>>
show_caption_above_mediaOption<bool>
widthOption<i64>
heightOption<i64>
durationOption<i64>
has_spoilerOption<bool>
InputMediaAudio 8
mediaString
thumbnailOption<String>
captionOption<String>
parse_modeOption<String>
caption_entitiesOption<Vec<MessageEntity>>
durationOption<i64>
performerOption<String>
titleOption<String>
InputMediaDocument 6
mediaString
thumbnailOption<String>
captionOption<String>
parse_modeOption<String>
caption_entitiesOption<Vec<MessageEntity>>
disable_content_type_detectionOption<bool>
InputMediaPhoto 6
mediaString
captionOption<String>
parse_modeOption<String>
caption_entitiesOption<Vec<MessageEntity>>
show_caption_above_mediaOption<bool>
has_spoilerOption<bool>
InputMediaVideo 13
mediaString
thumbnailOption<String>
coverOption<String>
start_timestampOption<i64>
captionOption<String>
parse_modeOption<String>
caption_entitiesOption<Vec<MessageEntity>>
show_caption_above_mediaOption<bool>
widthOption<i64>
heightOption<i64>
durationOption<i64>
supports_streamingOption<bool>
has_spoilerOption<bool>
InputPaidMediaPhoto 1
mediaString
InputPaidMediaVideo 8
mediaString
thumbnailOption<String>
coverOption<String>
start_timestampOption<i64>
widthOption<i64>
heightOption<i64>
durationOption<i64>
supports_streamingOption<bool>
InputPollOption 3
textString
text_parse_modeOption<String>
text_entitiesOption<Vec<MessageEntity>>
InputProfilePhotoAnimated 2
animationString
main_frame_timestampOption<f64>
InputProfilePhotoStatic 1
photoString
InputSticker 5
stickerString
formatString
emoji_listVec<String>
mask_positionOption<Box<MaskPosition>>
keywordsOption<Vec<String>>
InputStoryContentPhoto 1
photoString
InputStoryContentVideo 4
videoString
durationOption<f64>
cover_frame_timestampOption<f64>
is_animationOption<bool>
InputTextMessageContent 4
message_textString
parse_modeOption<String>
entitiesOption<Vec<MessageEntity>>
link_preview_optionsOption<Box<LinkPreviewOptions>>
InputVenueMessageContent 8
latitudef64
longitudef64
titleString
addressString
foursquare_idOption<String>
foursquare_typeOption<String>
google_place_idOption<String>
google_place_typeOption<String>
Invoice 5
titleString
descriptionString
start_parameterString
currencyString
total_amounti64
KeyboardButton 9
textString
icon_custom_emoji_idOption<String>
styleOption<String>
request_usersOption<Box<KeyboardButtonRequestUsers>>
request_chatOption<Box<KeyboardButtonRequestChat>>
request_contactOption<bool>
request_locationOption<bool>
request_pollOption<Box<KeyboardButtonPollType>>
web_appOption<Box<WebAppInfo>>
KeyboardButtonPollType 0
no public fields
KeyboardButtonRequestChat 11
request_idi64
chat_is_channelbool
chat_is_forumOption<bool>
chat_has_usernameOption<bool>
chat_is_createdOption<bool>
user_administrator_rightsOption<Box<ChatAdministratorRights>>
bot_administrator_rightsOption<Box<ChatAdministratorRights>>
bot_is_memberOption<bool>
request_titleOption<bool>
request_usernameOption<bool>
request_photoOption<bool>
KeyboardButtonRequestUsers 7
request_idi64
user_is_botOption<bool>
user_is_premiumOption<bool>
max_quantityOption<i64>
request_nameOption<bool>
request_usernameOption<bool>
request_photoOption<bool>
LabeledPrice 2
labelString
amounti64
LinkPreviewOptions 5
is_disabledOption<bool>
urlOption<String>
prefer_small_mediaOption<bool>
prefer_large_mediaOption<bool>
show_above_textOption<bool>
Location 6
latitudef64
longitudef64
horizontal_accuracyOption<f64>
live_periodOption<i64>
headingOption<i64>
proximity_alert_radiusOption<i64>
LocationAddress 4
country_codeString
stateOption<String>
cityOption<String>
streetOption<String>
LoginUrl 4
urlString
forward_textOption<String>
bot_usernameOption<String>
request_write_accessOption<bool>
MaskPosition 4
pointString
x_shiftf64
y_shiftf64
scalef64
MenuButtonCommands 0
no public fields
MenuButtonDefault 0
no public fields
MenuButtonWebApp 2
textString
web_appWebAppInfo
Message 105
message_idi64
message_thread_idOption<i64>
direct_messages_topicOption<Box<DirectMessagesTopic>>
fromOption<Box<User>>
sender_chatOption<Box<Chat>>
sender_boost_countOption<i64>
sender_business_botOption<Box<User>>
datei64
business_connection_idOption<String>
chatChat
forward_originOption<Box<MessageOrigin>>
is_topic_messageOption<bool>
is_automatic_forwardOption<bool>
reply_to_messageOption<Box<Message>>
external_replyOption<Box<ExternalReplyInfo>>
quoteOption<Box<TextQuote>>
reply_to_storyOption<Box<Story>>
reply_to_checklist_task_idOption<i64>
via_botOption<Box<User>>
edit_dateOption<i64>
has_protected_contentOption<bool>
is_from_offlineOption<bool>
is_paid_postOption<bool>
media_group_idOption<String>
author_signatureOption<String>
paid_star_countOption<i64>
textOption<String>
entitiesOption<Vec<MessageEntity>>
link_preview_optionsOption<Box<LinkPreviewOptions>>
suggested_post_infoOption<Box<SuggestedPostInfo>>
effect_idOption<String>
animationOption<Box<Animation>>
audioOption<Box<Audio>>
documentOption<Box<Document>>
paid_mediaOption<Box<PaidMediaInfo>>
photoOption<Vec<PhotoSize>>
stickerOption<Box<Sticker>>
storyOption<Box<Story>>
videoOption<Box<Video>>
video_noteOption<Box<VideoNote>>
voiceOption<Box<Voice>>
captionOption<String>
caption_entitiesOption<Vec<MessageEntity>>
show_caption_above_mediaOption<bool>
has_media_spoilerOption<bool>
checklistOption<Box<Checklist>>
contactOption<Box<Contact>>
diceOption<Box<Dice>>
gameOption<Box<Game>>
pollOption<Box<Poll>>
venueOption<Box<Venue>>
locationOption<Box<Location>>
new_chat_membersOption<Vec<User>>
left_chat_memberOption<Box<User>>
chat_owner_leftOption<Box<ChatOwnerLeft>>
chat_owner_changedOption<Box<ChatOwnerChanged>>
new_chat_titleOption<String>
new_chat_photoOption<Vec<PhotoSize>>
delete_chat_photoOption<bool>
group_chat_createdOption<bool>
supergroup_chat_createdOption<bool>
channel_chat_createdOption<bool>
message_auto_delete_timer_changedOption<Box<MessageAutoDeleteTimerChanged>>
migrate_to_chat_idOption<i64>
migrate_from_chat_idOption<i64>
pinned_messageOption<Box<MaybeInaccessibleMessage>>
invoiceOption<Box<Invoice>>
successful_paymentOption<Box<SuccessfulPayment>>
refunded_paymentOption<Box<RefundedPayment>>
users_sharedOption<Box<UsersShared>>
chat_sharedOption<Box<ChatShared>>
giftOption<Box<GiftInfo>>
unique_giftOption<Box<UniqueGiftInfo>>
gift_upgrade_sentOption<Box<GiftInfo>>
connected_websiteOption<String>
write_access_allowedOption<Box<WriteAccessAllowed>>
passport_dataOption<Box<PassportData>>
proximity_alert_triggeredOption<Box<ProximityAlertTriggered>>
boost_addedOption<Box<ChatBoostAdded>>
chat_background_setOption<Box<ChatBackground>>
checklist_tasks_doneOption<Box<ChecklistTasksDone>>
checklist_tasks_addedOption<Box<ChecklistTasksAdded>>
direct_message_price_changedOption<Box<DirectMessagePriceChanged>>
forum_topic_createdOption<Box<ForumTopicCreated>>
forum_topic_editedOption<Box<ForumTopicEdited>>
forum_topic_closedOption<Box<ForumTopicClosed>>
forum_topic_reopenedOption<Box<ForumTopicReopened>>
general_forum_topic_hiddenOption<Box<GeneralForumTopicHidden>>
general_forum_topic_unhiddenOption<Box<GeneralForumTopicUnhidden>>
giveaway_createdOption<Box<GiveawayCreated>>
giveawayOption<Box<Giveaway>>
giveaway_winnersOption<Box<GiveawayWinners>>
giveaway_completedOption<Box<GiveawayCompleted>>
paid_message_price_changedOption<Box<PaidMessagePriceChanged>>
suggested_post_approvedOption<Box<SuggestedPostApproved>>
suggested_post_approval_failedOption<Box<SuggestedPostApprovalFailed>>
suggested_post_declinedOption<Box<SuggestedPostDeclined>>
suggested_post_paidOption<Box<SuggestedPostPaid>>
suggested_post_refundedOption<Box<SuggestedPostRefunded>>
video_chat_scheduledOption<Box<VideoChatScheduled>>
video_chat_startedOption<Box<VideoChatStarted>>
video_chat_endedOption<Box<VideoChatEnded>>
video_chat_participants_invitedOption<Box<VideoChatParticipantsInvited>>
web_app_dataOption<Box<WebAppData>>
reply_markupOption<Box<InlineKeyboardMarkup>>
MessageAutoDeleteTimerChanged 1
message_auto_delete_timei64
MessageEntity 6
offseti64
lengthi64
urlOption<String>
userOption<Box<User>>
languageOption<String>
custom_emoji_idOption<String>
MessageId 1
message_idi64
MessageOriginChannel 4
datei64
chatChat
message_idi64
author_signatureOption<String>
MessageOriginChat 3
datei64
sender_chatChat
author_signatureOption<String>
MessageOriginHiddenUser 2
datei64
sender_user_nameString
MessageOriginUser 2
datei64
sender_userUser
MessageReactionCountUpdated 4
chatChat
message_idi64
datei64
reactionsVec<ReactionCount>
MessageReactionUpdated 7
chatChat
message_idi64
userOption<Box<User>>
actor_chatOption<Box<Chat>>
datei64
old_reactionVec<ReactionType>
new_reactionVec<ReactionType>
OrderInfo 4
nameOption<String>
phone_numberOption<String>
emailOption<String>
shipping_addressOption<Box<ShippingAddress>>
OwnedGiftRegular 14
giftGift
owned_gift_idOption<String>
sender_userOption<Box<User>>
send_datei64
textOption<String>
entitiesOption<Vec<MessageEntity>>
is_privateOption<bool>
is_savedOption<bool>
can_be_upgradedOption<bool>
was_refundedOption<bool>
convert_star_countOption<i64>
prepaid_upgrade_star_countOption<i64>
is_upgrade_separateOption<bool>
unique_gift_numberOption<i64>
OwnedGiftUnique 8
giftUniqueGift
owned_gift_idOption<String>
sender_userOption<Box<User>>
send_datei64
is_savedOption<bool>
can_be_transferredOption<bool>
transfer_star_countOption<i64>
next_transfer_dateOption<i64>
OwnedGifts 3
total_counti64
giftsVec<OwnedGift>
next_offsetOption<String>
PaidMediaInfo 2
star_counti64
paid_mediaVec<PaidMedia>
PaidMediaPhoto 1
photoVec<PhotoSize>
PaidMediaPreview 3
widthOption<i64>
heightOption<i64>
durationOption<i64>
PaidMediaPurchased 2
fromUser
paid_media_payloadString
PaidMediaVideo 1
videoVideo
PaidMessagePriceChanged 1
paid_message_star_counti64
PassportData 2
dataVec<EncryptedPassportElement>
credentialsEncryptedCredentials
PassportElementErrorDataField 4
sourceString
field_nameString
data_hashString
messageString
PassportElementErrorFile 3
sourceString
file_hashString
messageString
PassportElementErrorFiles 3
sourceString
file_hashesVec<String>
messageString
PassportElementErrorFrontSide 3
sourceString
file_hashString
messageString
PassportElementErrorReverseSide 3
sourceString
file_hashString
messageString
PassportElementErrorSelfie 3
sourceString
file_hashString
messageString
PassportElementErrorTranslationFile 3
sourceString
file_hashString
messageString
PassportElementErrorTranslationFiles 3
sourceString
file_hashesVec<String>
messageString
PassportElementErrorUnspecified 3
sourceString
element_hashString
messageString
PassportFile 4
file_idString
file_unique_idString
file_sizei64
file_datei64
PhotoSize 5
file_idString
file_unique_idString
widthi64
heighti64
file_sizeOption<i64>
Poll 13
idString
questionString
question_entitiesOption<Vec<MessageEntity>>
optionsVec<PollOption>
total_voter_counti64
is_closedbool
is_anonymousbool
allows_multiple_answersbool
correct_option_idOption<i64>
explanationOption<String>
explanation_entitiesOption<Vec<MessageEntity>>
open_periodOption<i64>
close_dateOption<i64>
PollAnswer 4
poll_idString
voter_chatOption<Box<Chat>>
userOption<Box<User>>
option_idsVec<i64>
PollOption 3
textString
text_entitiesOption<Vec<MessageEntity>>
voter_counti64
PreCheckoutQuery 7
idString
fromUser
currencyString
total_amounti64
invoice_payloadString
shipping_option_idOption<String>
order_infoOption<Box<OrderInfo>>
PreparedInlineMessage 2
idString
expiration_datei64
ProximityAlertTriggered 3
travelerUser
watcherUser
distancei64
ReactionCount 1
total_counti64
ReactionTypeCustomEmoji 1
custom_emoji_idString
ReactionTypeEmoji 1
emojiString
ReactionTypePaid 0
no public fields
RefundedPayment 5
currencyString
total_amounti64
invoice_payloadString
telegram_payment_charge_idString
provider_payment_charge_idOption<String>
ReplyKeyboardMarkup 6
keyboardVec<Vec<KeyboardButton>>
is_persistentOption<bool>
resize_keyboardOption<bool>
one_time_keyboardOption<bool>
input_field_placeholderOption<String>
selectiveOption<bool>
ReplyKeyboardRemove 2
remove_keyboardbool
selectiveOption<bool>
ReplyParameters 8
message_idi64
chat_idOption<ChatId>
allow_sending_without_replyOption<bool>
quoteOption<String>
quote_parse_modeOption<String>
quote_entitiesOption<Vec<MessageEntity>>
quote_positionOption<i64>
checklist_task_idOption<i64>
ResponseParameters 2
migrate_to_chat_idOption<i64>
retry_afterOption<i64>
RevenueWithdrawalStateFailed 0
no public fields
RevenueWithdrawalStatePending 0
no public fields
RevenueWithdrawalStateSucceeded 2
datei64
urlString
SentWebAppMessage 1
inline_message_idOption<String>
SharedUser 5
user_idi64
first_nameOption<String>
last_nameOption<String>
usernameOption<String>
photoOption<Vec<PhotoSize>>
ShippingAddress 6
country_codeString
stateString
cityString
street_line1String
street_line2String
post_codeString
ShippingOption 3
idString
titleString
pricesVec<LabeledPrice>
ShippingQuery 4
idString
fromUser
invoice_payloadString
shipping_addressShippingAddress
StarAmount 2
amounti64
nanostar_amountOption<i64>
StarTransaction 6
idString
amounti64
nanostar_amountOption<i64>
datei64
sourceOption<Box<TransactionPartner>>
receiverOption<Box<TransactionPartner>>
StarTransactions 1
transactionsVec<StarTransaction>
Sticker 14
file_idString
file_unique_idString
widthi64
heighti64
is_animatedbool
is_videobool
thumbnailOption<Box<PhotoSize>>
emojiOption<String>
set_nameOption<String>
premium_animationOption<Box<File>>
mask_positionOption<Box<MaskPosition>>
custom_emoji_idOption<String>
needs_repaintingOption<bool>
file_sizeOption<i64>
StickerSet 5
nameString
titleString
sticker_typeString
stickersVec<Sticker>
thumbnailOption<Box<PhotoSize>>
Story 2
chatChat
idi64
StoryArea 1
positionStoryAreaPosition
StoryAreaPosition 6
x_percentagef64
y_percentagef64
width_percentagef64
height_percentagef64
rotation_anglef64
corner_radius_percentagef64
StoryAreaTypeLocation 3
latitudef64
longitudef64
addressOption<Box<LocationAddress>>
StoryAreaTypeSuggestedReaction 3
reaction_typeReactionType
is_darkOption<bool>
is_flippedOption<bool>
StoryAreaTypeUniqueGift 1
nameString
StoryAreaTypeWeather 3
temperaturef64
emojiString
background_colori64
SuccessfulPayment 10
currencyString
total_amounti64
invoice_payloadString
subscription_expiration_dateOption<i64>
is_recurringOption<bool>
is_first_recurringOption<bool>
shipping_option_idOption<String>
order_infoOption<Box<OrderInfo>>
telegram_payment_charge_idString
provider_payment_charge_idString
SuggestedPostApprovalFailed 2
suggested_post_messageOption<Box<Message>>
priceSuggestedPostPrice
SuggestedPostApproved 3
suggested_post_messageOption<Box<Message>>
priceOption<Box<SuggestedPostPrice>>
send_datei64
SuggestedPostDeclined 2
suggested_post_messageOption<Box<Message>>
commentOption<String>
SuggestedPostInfo 3
stateString
priceOption<Box<SuggestedPostPrice>>
send_dateOption<i64>
SuggestedPostPaid 4
suggested_post_messageOption<Box<Message>>
currencyString
amountOption<i64>
star_amountOption<Box<StarAmount>>
SuggestedPostParameters 2
priceOption<Box<SuggestedPostPrice>>
send_dateOption<i64>
SuggestedPostPrice 2
currencyString
amounti64
SuggestedPostRefunded 2
suggested_post_messageOption<Box<Message>>
reasonString
SwitchInlineQueryChosenChat 5
queryOption<String>
allow_user_chatsOption<bool>
allow_bot_chatsOption<bool>
allow_group_chatsOption<bool>
allow_channel_chatsOption<bool>
TextQuote 4
textString
entitiesOption<Vec<MessageEntity>>
positioni64
is_manualOption<bool>
TransactionPartnerAffiliateProgram 2
sponsor_userOption<Box<User>>
commission_per_millei64
TransactionPartnerChat 2
chatChat
giftOption<Box<Gift>>
TransactionPartnerFragment 1
withdrawal_stateOption<Box<RevenueWithdrawalState>>
TransactionPartnerOther 0
no public fields
TransactionPartnerTelegramAds 0
no public fields
TransactionPartnerTelegramApi 1
request_counti64
TransactionPartnerUser 9
transaction_typeString
userUser
affiliateOption<Box<AffiliateInfo>>
invoice_payloadOption<String>
subscription_periodOption<i64>
paid_mediaOption<Vec<PaidMedia>>
paid_media_payloadOption<String>
giftOption<Box<Gift>>
premium_subscription_durationOption<i64>
UniqueGift 12
gift_idString
base_nameString
nameString
numberi64
modelUniqueGiftModel
symbolUniqueGiftSymbol
backdropUniqueGiftBackdrop
is_premiumOption<bool>
is_burnedOption<bool>
is_from_blockchainOption<bool>
colorsOption<Box<UniqueGiftColors>>
publisher_chatOption<Box<Chat>>
UniqueGiftBackdrop 3
nameString
colorsUniqueGiftBackdropColors
rarity_per_millei64
UniqueGiftBackdropColors 4
center_colori64
edge_colori64
symbol_colori64
text_colori64
UniqueGiftColors 6
model_custom_emoji_idString
symbol_custom_emoji_idString
light_theme_main_colori64
light_theme_other_colorsVec<i64>
dark_theme_main_colori64
dark_theme_other_colorsVec<i64>
UniqueGiftInfo 7
giftUniqueGift
originString
last_resale_currencyOption<String>
last_resale_amountOption<i64>
owned_gift_idOption<String>
transfer_star_countOption<i64>
next_transfer_dateOption<i64>
UniqueGiftModel 4
nameString
stickerSticker
rarity_per_millei64
rarityOption<String>
UniqueGiftSymbol 3
nameString
stickerSticker
rarity_per_millei64
Update 24
update_idi64
messageOption<Box<Message>>
edited_messageOption<Box<Message>>
channel_postOption<Box<Message>>
edited_channel_postOption<Box<Message>>
business_connectionOption<Box<BusinessConnection>>
business_messageOption<Box<Message>>
edited_business_messageOption<Box<Message>>
deleted_business_messagesOption<Box<BusinessMessagesDeleted>>
message_reactionOption<Box<MessageReactionUpdated>>
message_reaction_countOption<Box<MessageReactionCountUpdated>>
inline_queryOption<Box<InlineQuery>>
chosen_inline_resultOption<Box<ChosenInlineResult>>
callback_queryOption<Box<CallbackQuery>>
shipping_queryOption<Box<ShippingQuery>>
pre_checkout_queryOption<Box<PreCheckoutQuery>>
purchased_paid_mediaOption<Box<PaidMediaPurchased>>
pollOption<Box<Poll>>
poll_answerOption<Box<PollAnswer>>
my_chat_memberOption<Box<ChatMemberUpdated>>
chat_memberOption<Box<ChatMemberUpdated>>
chat_join_requestOption<Box<ChatJoinRequest>>
chat_boostOption<Box<ChatBoostUpdated>>
removed_chat_boostOption<Box<ChatBoostRemoved>>
User 15
idi64
is_botbool
first_nameString
last_nameOption<String>
usernameOption<String>
language_codeOption<String>
is_premiumOption<bool>
added_to_attachment_menuOption<bool>
can_join_groupsOption<bool>
can_read_all_group_messagesOption<bool>
supports_inline_queriesOption<bool>
can_connect_to_businessOption<bool>
has_main_web_appOption<bool>
has_topics_enabledOption<bool>
allows_users_to_create_topicsOption<bool>
UserChatBoosts 1
boostsVec<ChatBoost>
UserProfileAudios 2
total_counti64
audiosVec<Audio>
UserProfilePhotos 2
total_counti64
photosVec<Vec<PhotoSize>>
UserRating 4
leveli64
ratingi64
current_level_ratingi64
next_level_ratingOption<i64>
UsersShared 2
request_idi64
usersVec<SharedUser>
Venue 7
locationLocation
titleString
addressString
foursquare_idOption<String>
foursquare_typeOption<String>
google_place_idOption<String>
google_place_typeOption<String>
Video 12
file_idString
file_unique_idString
widthi64
heighti64
durationi64
thumbnailOption<Box<PhotoSize>>
coverOption<Vec<PhotoSize>>
start_timestampOption<i64>
qualitiesOption<Vec<VideoQuality>>
file_nameOption<String>
mime_typeOption<String>
file_sizeOption<i64>
VideoChatEnded 1
durationi64
VideoChatParticipantsInvited 1
usersVec<User>
VideoChatScheduled 1
start_datei64
VideoNote 6
file_idString
file_unique_idString
lengthi64
durationi64
thumbnailOption<Box<PhotoSize>>
file_sizeOption<i64>
VideoQuality 6
file_idString
file_unique_idString
widthi64
heighti64
codecString
file_sizeOption<i64>
Voice 5
file_idString
file_unique_idString
durationi64
mime_typeOption<String>
file_sizeOption<i64>
WebAppData 2
dataString
button_textString
WebAppInfo 1
urlString
WebhookInfo 9
urlString
has_custom_certificatebool
pending_update_counti64
ip_addressOption<String>
last_error_dateOption<i64>
last_error_messageOption<String>
last_synchronization_error_dateOption<i64>
max_connectionsOption<i64>
allowed_updatesOption<Vec<String>>
WriteAccessAllowed 3
from_requestOption<bool>
web_app_nameOption<String>
from_attachment_menuOption<bool>
BackgroundFill
BackgroundFillSolid BackgroundFillGradient BackgroundFillFreeformGradient
BackgroundType
BackgroundTypeFill BackgroundTypeWallpaper BackgroundTypePattern BackgroundTypeChatTheme
BotCommandScope
BotCommandScopeDefault BotCommandScopeAllPrivateChats BotCommandScopeAllGroupChats BotCommandScopeAllChatAdministrators BotCommandScopeChat BotCommandScopeChatAdministrators BotCommandScopeChatMember
ChatBoostSource
ChatBoostSourcePremium ChatBoostSourceGiftCode ChatBoostSourceGiveaway
ChatMember
ChatMemberOwner ChatMemberAdministrator ChatMemberMember ChatMemberRestricted ChatMemberLeft ChatMemberBanned
InlineQueryResult
InlineQueryResultCachedAudio InlineQueryResultCachedDocument InlineQueryResultCachedGif InlineQueryResultCachedMpeg4Gif InlineQueryResultCachedPhoto InlineQueryResultCachedSticker InlineQueryResultCachedVideo InlineQueryResultCachedVoice InlineQueryResultArticle InlineQueryResultAudio InlineQueryResultContact InlineQueryResultGame InlineQueryResultDocument InlineQueryResultGif InlineQueryResultLocation InlineQueryResultMpeg4Gif InlineQueryResultPhoto InlineQueryResultVenue InlineQueryResultVideo InlineQueryResultVoice
InputMessageContent
InputTextMessageContent InputLocationMessageContent InputVenueMessageContent InputContactMessageContent InputInvoiceMessageContent
InputPaidMedia
InputPaidMediaPhoto InputPaidMediaVideo
InputProfilePhoto
InputProfilePhotoStatic InputProfilePhotoAnimated
InputStoryContent
InputStoryContentPhoto InputStoryContentVideo
MaybeInaccessibleMessage
Message InaccessibleMessage
MenuButton
MenuButtonCommands MenuButtonWebApp MenuButtonDefault
MessageOrigin
MessageOriginUser MessageOriginHiddenUser MessageOriginChat MessageOriginChannel
OwnedGift
OwnedGiftRegular OwnedGiftUnique
PaidMedia
PaidMediaPreview PaidMediaPhoto PaidMediaVideo
PassportElementError
PassportElementErrorDataField PassportElementErrorFrontSide PassportElementErrorReverseSide PassportElementErrorSelfie PassportElementErrorFile PassportElementErrorFiles PassportElementErrorTranslationFile PassportElementErrorTranslationFiles PassportElementErrorUnspecified
ReactionType
ReactionTypeEmoji ReactionTypeCustomEmoji ReactionTypePaid
RevenueWithdrawalState
RevenueWithdrawalStatePending RevenueWithdrawalStateSucceeded RevenueWithdrawalStateFailed
StoryAreaType
StoryAreaTypeLocation StoryAreaTypeSuggestedReaction StoryAreaTypeLink StoryAreaTypeWeather StoryAreaTypeUniqueGift
TransactionPartner
TransactionPartnerUser TransactionPartnerChat TransactionPartnerAffiliateProgram TransactionPartnerFragment TransactionPartnerTelegramAds TransactionPartnerTelegramApi TransactionPartnerOther
ChatId

Accepts numeric IDs or username strings.

bot.send_message(123456789i64, "text", None).await?;
bot.send_message("@mychannel", "text", None).await?;
InputFile

Flexible file input — path, URL, or bytes.

use tgbotrs::InputFile;
let by_path  = InputFile::path("photo.jpg");
let by_url   = InputFile::url("https://example.com/photo.jpg");
let by_bytes = InputFile::bytes("photo.jpg", std::fs::read("photo.jpg").unwrap());

⚠️ Error Handling

All calls return Result<T, BotError>

BotError variants
BotError::Api { code, description, retry_after, migrate_to_chat_id }
Telegram returned ok=false. 429=flood, 403=blocked, 400=bad request.
BotError::Http(reqwest::Error)
Network error — connection refused, timeout, DNS failure.
BotError::Json(serde_json::Error)
Failed to (de)serialize request or response.
BotError::InvalidToken
Token doesn't contain a colon — invalid format.
Error handling patterns
match bot.send_message(chat_id, text, None).await {
    Ok(msg) => println!("Sent #{}", msg.message_id),
    Err(BotError::Api { code: 403, .. }) => println!("Bot was blocked"),
    Err(BotError::Api { code: 429, retry_after: Some(secs), .. }) => {
        tokio::time::sleep(std::time::Duration::from_secs(secs as u64)).await;
    }
    Err(e) => eprintln!("Error: {}", e),
}