Methods
🦀 Telegram Bot API 9.6 · Auto-Generated · v0.1.0

ferobot Rust Telegram Bot library

ferobot gives you every Telegram Bot API method and type, fully typed, fully async, auto-generated directly from the official spec. Zero missed methods. Zero stale types. Built for production.

169Methods
270Types
9.6API
100%Async

Quick Start

Echo bot in under 2 minutes.

1. Get your bot token
Chat with @BotFather → /newbot → copy token.
2. Cargo.toml
Cargo.toml
[dependencies]
ferobot = "0.1.0"
tokio = { version = "1", features = ["full"] }
3. src/main.rs
use ferobot::{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 ferobot 🦀".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();
}
4. Run
cargo run

Installation

Pick the features you need. Everything is opt-in.

Basic (Long Polling)
[dependencies]
ferobot = "0.1.0"
tokio = { version = "1", features = ["full"] }
With Webhook
[dependencies]
ferobot = { version = "0.1.0", features = ["webhook"] }
tokio = { version = "1", features = ["full"] }
Per-chat Concurrency

Serializes updates per chat_id. No ordering bugs under load.

[dependencies]
ferobot = { version = "0.1.0", features = ["per-chat"] }
tokio = { version = "1", features = ["full"] }
Redis Conversation Storage

Persistent conversation state for multi-process / distributed bots.

[dependencies]
ferobot = { version = "0.1.0", features = ["redis-storage"] }
tokio = { version = "1", features = ["full"] }
Sync Client (ureq)
[dependencies]
ferobot = { version = "0.1.0", features = ["client-ureq"] }
All Features
[dependencies]
ferobot = { version = "0.1.0", features = [
 "webhook", "bot-mapping",
 "per-chat", "redis-storage",
 "client-ureq",
] }
tokio = { version = "1", features = ["full"] }
Token from env
let token = std::env::var("BOT_TOKEN")
 .expect("BOT_TOKEN not set");
let bot = Bot::new(token).await?;

Features

What you get out of the box, and what you opt into.

Fully Async
Built on Tokio. One spawned task per update, bounded by a configurable semaphore.
🔒
Strongly Typed
Every method, parameter, and response type is generated from the official Telegram spec. Compile-time safety.
🤖
Auto-Generated API
All 169 methods and 270 types regenerate from api.json on every release tag. Never outdated.
🏗️
Builder Pattern
Chain optional params with .parse_mode("HTML") .reply_to_message_id(id), etc.
🪝
Built-in Webhook
Axum-based WebhookServer that returns 200 immediately and processes async. Same handler interface as Poller.
🧩
Framework / Dispatcher
Dispatcher with CommandHandler MessageHandler, filters, groups, and conversation state.
🗂️
Per-chat Ordering per-chat
One sequential worker per chat_id. Updates for the same chat never race; different chats run in parallel.
🔴
Redis Storage redis-storage
Drop-in RedisStorage for ConversationHandler. Supports TTL, key prefix, distributed bots.
📁
File Uploads
Upload by file_id, URL, or in-memory bytes. Multipart is handled transparently.
🎯
ChatId Flexibility
Pass i64 &str, or @username. All conversions automatic.
🔌
Pluggable HTTP Client
Implement BotClient to inject a mock, proxy, or custom transport. Useful for unit tests.
🔄
Sync Client client-ureq
SyncBot backed by ureq for scripts and CLI tools that don't need async.

Performance internals

Four specific improvements over a naive dispatcher design, listed in impact order.

What changedBeforeAfterWhy it matters
FIX 1Handler map reads
Arc<ArcSwap<HandlerMap>>
RwLock.clone(), copies the entire BTreeMap on every update Atomic pointer load via arc_swap, zero map clone, no lock at all on the read path At millions of updates/sec, eliminating the heap allocation per read is significant
FIX 2Panic isolation
AssertUnwindSafe::catch_unwind
One outer task + one inner tokio::spawn per matched handler = 2× task overhead Single task per update; catch_unwind replaces the inner spawn Halves task-allocation cost; panic isolation is preserved, a panicking handler can't kill the loop
OPTPer-chat ordering
per-chat feature
Global semaphore, one spammy chat can starve everyone; updates for same chat may race DashMap<chat_id, mpsc::Sender>, one sequential worker per chat, parallel across chats Correct ordering without locks; same pattern used by aiogram and PTB for millions of users
OPTDistributed storage
redis-storage feature
InMemoryStorage dies on restart; can't share state across processes RedisStorage with auto-reconnect ConnectionManager; optional TTL per key Enables horizontal scaling, multiple bot instances share conversation state transparently
Single-process capacity with default settings: ~50k–100k concurrent users. For true millions: webhook + horizontal scaling + Redis storage.

Long Polling

No external server needed. Good for development and small bots.

Minimal
use ferobot::{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 {
 if let Some(msg) = update.message {
 let _ = bot.send_message(msg.chat.id, "pong! 🏓", None).await;
 }
 })
 });
 Poller::new(bot, handler)
 .timeout(30) // long-poll timeout in seconds
 .limit(100) // max updates per batch
 .start()
 .await
 .unwrap();
}
With inline keyboard
use ferobot::{Bot, Poller, UpdateHandler};
use ferobot::gen_methods::{SendMessageParams, AnswerCallbackQueryParams};
use ferobot::types::{InlineKeyboardMarkup, InlineKeyboardButton};
use ferobot::ReplyMarkup;

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 p = SendMessageParams::new().reply_markup(keyboard);
 let _ = bot.send_message(msg.chat.id, "Pick a button 👇", Some(p)).await;
 }
 }
 if let Some(cq) = update.callback_query {
 let p = AnswerCallbackQueryParams::new().text("Clicked! ✅".to_string());
 let _ = bot.answer_callback_query(cq.id, Some(p)).await;
 }
 })
});

Webhook Server

Production-ready. Built on Axum. Returns 200 instantly, processes updates async.

Setup
use ferobot::{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") // validates X-Telegram-Bot-Api-Secret-Token
 .max_connections(40)
 .concurrency(512) // max async tasks in flight
 .drop_pending_updates() // clean slate on start
 .start("https://yourdomain.com")
 .await
 .unwrap();
}
Why webhook is faster than polling for large bots

Polling delivers at most 100 updates per batch. Telegram will push webhook requests in parallel up to max_connections (max 100). For bots handling thousands of users simultaneously, webhook + horizontal scaling is the only viable approach.

ferobot's webhook handler spawns the user callback immediately and responds 200 before the callback completes, so Telegram never sees timeouts and never backs off.

Framework / Dispatcher

Structured routing with handler groups, filters, and conversation state.

Command handlers
use ferobot::{Bot, CommandHandler, Dispatcher, DispatcherOpts, Updater};
use ferobot::framework::{HandlerResult, Context};

async fn start(bot: Bot, ctx: Context) -> HandlerResult {
 if let Some(msg) = ctx.effective_message() {
 msg.reply(&bot, "Hello! 👋", None).await?;
 }
 Ok(())
}

async fn help(bot: Bot, ctx: Context) -> HandlerResult {
 if let Some(msg) = ctx.effective_message() {
 msg.reply(&bot, "Commands: /start /help", None).await?;
 }
 Ok(())
}

#[tokio::main]
async fn main() {
 let bot = Bot::new("YOUR_BOT_TOKEN").await.unwrap();
 let mut dp = Dispatcher::new(DispatcherOpts::default()
 .max_routines(512) // bound concurrency
 .on_error(|_bot, _ctx, err| {
 eprintln!("Handler error: {err}");
 ferobot::framework::DispatcherAction::Noop
 })
 .on_panic(|_bot, _ctx, msg| eprintln!("Handler panicked: {msg}"))
 );
 dp.add_handler(CommandHandler::new("start", start));
 dp.add_handler(CommandHandler::new("help", help));
 Updater::new(bot, dp).start_polling().await.unwrap();
}
Handler groups & filters
use ferobot::{MessageHandler, CallbackQueryHandler};

// Group 0 runs before group 1.
// Within a group the first matching handler wins.
dp.add_handler_to_group(
 CommandHandler::new("admin", admin_fn),
 0, // high priority
);
dp.add_handler_to_group(
 MessageHandler::new("catch_text", |ctx| {
 ctx.effective_message().and_then(|m| m.text.as_deref())
 .map(|t| !t.starts_with('/'))
 .unwrap_or(false)
 }, handle_text),
 1, // lower priority
);

// Remove a handler at runtime
dp.remove_handler("catch_text", 1);

Per-chat Concurrency per-chat feature

One sequential worker task per chat_id. Updates for the same chat are processed in arrival order; different chats run in parallel. This is the pattern used by aiogram and python-telegram-bot for high-scale bots.

Enable in Cargo.toml
ferobot = { version = "0.1.0", features = ["per-chat"] }
Enable on the Dispatcher
use ferobot::{Dispatcher, DispatcherOpts};

let dp = Dispatcher::new(
 DispatcherOpts::default()
 .per_chat_concurrency() // one worker task per chat_id
 .max_routines(1024), // global cap still applies
);

// That's it. The dispatcher routes automatically:

 
How it works internally

A DashMap<i64, mpsc::Sender<ChatWork>> maps each active chat ID to a dedicated tokio task. When an update arrives dispatch() looks up the sender for that chat and forwards the work. If no worker exists yet (or the previous one exited), a new one is spawned. Workers clean themselves up automatically when idle.

Redis Conversation Storage redis-storage feature

Persistent conversation state that survives restarts and works across multiple bot processes.

Enable in Cargo.toml
ferobot = { version = "0.1.0", features = ["redis-storage"] }
Usage
use ferobot::framework::handlers::conversation::{
 ConversationHandler, ConversationOpts,
 redis_storage::RedisStorage,
};

#[tokio::main]
async fn main() {
 // Connect once at startup, clone cheaply everywhere (Arc internally)
 let storage = RedisStorage::new("redis://127.0.0.1/")
 .await
 .expect("Redis connect failed")
 .with_prefix("mybot:conv:") // namespace for this bot
 .with_ttl(86_400); // expire idle conversations after 24 h

 let opts = ConversationOpts::default().storage(storage);
 // Pass opts to ConversationHandler as usual...
}
Notes

Uses Redis ConnectionManager, auto-reconnects on transient failures, multiplexes all commands over one TCP connection.

Runtime requirement: Bridges the sync ConversationStorage trait to async Redis via tokio::task::block_in_place. Requires the multi-thread Tokio scheduler (#[tokio::main] default). Will panic on Builder::new_current_thread().

TTL: Keys are refreshed on every set call. When a conversation is idle longer than the TTL, Redis evicts it automatically, no manual cleanup needed.

Conversation Handler

Stateful multi-step flows, wizards, forms, on-boarding. State is stored per-user or per-chat.

A simple two-step form
use ferobot::framework::handlers::conversation::{
 ConversationHandler, ConversationOpts, InMemoryStorage,
 KeyStrategy, NextState, EndConversation,
};
use ferobot::{CommandHandler, MessageHandler};
use std::collections::HashMap;

// Entry point: /register
async fn ask_name(bot: Bot, ctx: Context) -> HandlerResult {
 if let Some(msg) = ctx.effective_message() {
 msg.reply(&bot, "What's your name?", None).await?;
 }
 // Move to the "ask_name" state
 Err(Box::new(NextState("ask_name".into())))
}

// State: "ask_name"
async fn save_name(bot: Bot, ctx: Context) -> HandlerResult {
 if let Some(msg) = ctx.effective_message() {
 let name = msg.text.clone().unwrap_or_default();
 msg.reply(&bot, format!("Got it, {name}! /cancel to stop."), None).await?;
 }
 // End conversation
 Err(Box::new(EndConversation))
}

let storage = InMemoryStorage::new();
let opts = ConversationOpts::default()
 .storage(storage)
 .key_strategy(KeyStrategy::SenderAndChat);

let handler = ConversationHandler::new(
 vec![Box::new(CommandHandler::new("register", ask_name))],
 HashMap::from([(
 "ask_name".to_string(),
 vec![Box::new(MessageHandler::new("save_name",
 |_ctx| true, // match any message
 save_name,
 )) as Box<dyn Handler>]
 )]),
 opts,
);
Swapping to Redis storage

Only one line changes, everything else stays identical:

// Before:
let storage = InMemoryStorage::new();

// After (add feature = "redis-storage"):
let storage = RedisStorage::new("redis://127.0.0.1/")
 .await?
 .with_ttl(86_400);

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 wait, 403 = bot blocked, 400 = bad request.
BotError::Http(reqwest::Error)
Network error, timeout, DNS failure, connection refused.
BotError::Json(serde_json::Error)
Serialization or deserialization failure.
BotError::InvalidToken
Token does not contain a colon, caught at construction time.
Matching errors
use ferobot::{Bot, BotError};

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 by user");
 }
 Err(BotError::Api { code: 429, retry_after: Some(secs).. }) => {
 tokio::time::sleep(std::time::Duration::from_secs(secs as u64)).await;
 // retry...
 }
 Err(e) => eprintln!("Error: {}", e),
}
Filter: 169 methods

Sending Messages

22
bot.send_message()
async → Message +opts

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

chat_idtext
FieldTypeDescription
business_connection_idStringUnique identifier of the business connection on behalf of which the message will be sent
message_thread_idIntegerUnique 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_idIntegerIdentifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat
parse_modeStringMode for parsing entities in the message text. See formatting options for more details.
entitiesArray of MessageEntityA JSON-serialized list of special entities that appear in message text, which can be specified instead of parse_mode
link_preview_optionsLinkPreviewOptionsLink preview generation options for the message
disable_notificationBooleanSends the message silently. Users will receive a notification with no sound.
protect_contentBooleanProtects the contents of the sent message from forwarding and saving
allow_paid_broadcastBooleanPass 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_idStringUnique identifier of the message effect to be added to the message; for private chats only
suggested_post_parametersSuggestedPostParametersA 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_parametersReplyParametersDescription of the message to reply to
reply_markupInlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReplyAdditional 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 ferobot::{Bot, BotError};

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


 let result = bot.send_message().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_idphoto
FieldTypeDescription
business_connection_idStringUnique identifier of the business connection on behalf of which the message will be sent
message_thread_idIntegerUnique 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_idIntegerIdentifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat
captionStringPhoto caption (may also be used when resending photos by file_id), 0-1024 characters after entities parsing
parse_modeStringMode for parsing entities in the photo caption. See formatting options for more details.
caption_entitiesArray of MessageEntityA JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode
show_caption_above_mediaBooleanPass True, if the caption must be shown above the message media
has_spoilerBooleanPass True if the photo needs to be covered with a spoiler animation
disable_notificationBooleanSends the message silently. Users will receive a notification with no sound.
protect_contentBooleanProtects the contents of the sent message from forwarding and saving
allow_paid_broadcastBooleanPass 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_idStringUnique identifier of the message effect to be added to the message; for private chats only
suggested_post_parametersSuggestedPostParametersA 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_parametersReplyParametersDescription of the message to reply to
reply_markupInlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReplyAdditional 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 ferobot::{Bot, BotError};

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


 let result = bot.send_photo().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_idaudio
FieldTypeDescription
business_connection_idStringUnique identifier of the business connection on behalf of which the message will be sent
message_thread_idIntegerUnique 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_idIntegerIdentifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat
captionStringAudio caption, 0-1024 characters after entities parsing
parse_modeStringMode for parsing entities in the audio caption. See formatting options for more details.
caption_entitiesArray of MessageEntityA JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode
durationIntegerDuration of the audio in seconds
performerStringPerformer
titleStringTrack name
thumbnailInputFile | StringThumbnail 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_notificationBooleanSends the message silently. Users will receive a notification with no sound.
protect_contentBooleanProtects the contents of the sent message from forwarding and saving
allow_paid_broadcastBooleanPass 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_idStringUnique identifier of the message effect to be added to the message; for private chats only
suggested_post_parametersSuggestedPostParametersA 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_parametersReplyParametersDescription of the message to reply to
reply_markupInlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReplyAdditional 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 ferobot::{Bot, BotError};
use ferobot::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_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_iddocument
FieldTypeDescription
business_connection_idStringUnique identifier of the business connection on behalf of which the message will be sent
message_thread_idIntegerUnique 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_idIntegerIdentifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat
thumbnailInputFile | StringThumbnail 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
captionStringDocument caption (may also be used when resending documents by file_id), 0-1024 characters after entities parsing
parse_modeStringMode for parsing entities in the document caption. See formatting options for more details.
caption_entitiesArray of MessageEntityA JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode
disable_content_type_detectionBooleanDisables automatic server-side content type detection for files uploaded using multipart/form-data
disable_notificationBooleanSends the message silently. Users will receive a notification with no sound.
protect_contentBooleanProtects the contents of the sent message from forwarding and saving
allow_paid_broadcastBooleanPass 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_idStringUnique identifier of the message effect to be added to the message; for private chats only
suggested_post_parametersSuggestedPostParametersA 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_parametersReplyParametersDescription of the message to reply to
reply_markupInlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReplyAdditional 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 ferobot::{Bot, BotError};

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


 let result = bot.send_document().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_idvideo
FieldTypeDescription
business_connection_idStringUnique identifier of the business connection on behalf of which the message will be sent
message_thread_idIntegerUnique 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_idIntegerIdentifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat
durationIntegerDuration of sent video in seconds
widthIntegerVideo width
heightIntegerVideo height
thumbnailInputFile | StringThumbnail 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
coverInputFile | StringCover 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_timestampIntegerStart timestamp for the video in the message
captionStringVideo caption (may also be used when resending videos by file_id), 0-1024 characters after entities parsing
parse_modeStringMode for parsing entities in the video caption. See formatting options for more details.
caption_entitiesArray of MessageEntityA JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode
show_caption_above_mediaBooleanPass True, if the caption must be shown above the message media
has_spoilerBooleanPass True if the video needs to be covered with a spoiler animation
supports_streamingBooleanPass True if the uploaded video is suitable for streaming
disable_notificationBooleanSends the message silently. Users will receive a notification with no sound.
protect_contentBooleanProtects the contents of the sent message from forwarding and saving
allow_paid_broadcastBooleanPass 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_idStringUnique identifier of the message effect to be added to the message; for private chats only
suggested_post_parametersSuggestedPostParametersA 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_parametersReplyParametersDescription of the message to reply to
reply_markupInlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReplyAdditional 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 ferobot::{Bot, BotError};
use ferobot::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_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_idanimation
FieldTypeDescription
business_connection_idStringUnique identifier of the business connection on behalf of which the message will be sent
message_thread_idIntegerUnique 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_idIntegerIdentifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat
durationIntegerDuration of sent animation in seconds
widthIntegerAnimation width
heightIntegerAnimation height
thumbnailInputFile | StringThumbnail 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
captionStringAnimation caption (may also be used when resending animation by file_id), 0-1024 characters after entities parsing
parse_modeStringMode for parsing entities in the animation caption. See formatting options for more details.
caption_entitiesArray of MessageEntityA JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode
show_caption_above_mediaBooleanPass True, if the caption must be shown above the message media
has_spoilerBooleanPass True if the animation needs to be covered with a spoiler animation
disable_notificationBooleanSends the message silently. Users will receive a notification with no sound.
protect_contentBooleanProtects the contents of the sent message from forwarding and saving
allow_paid_broadcastBooleanPass 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_idStringUnique identifier of the message effect to be added to the message; for private chats only
suggested_post_parametersSuggestedPostParametersA 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_parametersReplyParametersDescription of the message to reply to
reply_markupInlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReplyAdditional 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 ferobot::{Bot, BotError};
use ferobot::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_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_idvoice
FieldTypeDescription
business_connection_idStringUnique identifier of the business connection on behalf of which the message will be sent
message_thread_idIntegerUnique 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_idIntegerIdentifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat
captionStringVoice message caption, 0-1024 characters after entities parsing
parse_modeStringMode for parsing entities in the voice message caption. See formatting options for more details.
caption_entitiesArray of MessageEntityA JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode
durationIntegerDuration of the voice message in seconds
disable_notificationBooleanSends the message silently. Users will receive a notification with no sound.
protect_contentBooleanProtects the contents of the sent message from forwarding and saving
allow_paid_broadcastBooleanPass 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_idStringUnique identifier of the message effect to be added to the message; for private chats only
suggested_post_parametersSuggestedPostParametersA 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_parametersReplyParametersDescription of the message to reply to
reply_markupInlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReplyAdditional 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 ferobot::{Bot, BotError};
use ferobot::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(())
}
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_note
FieldTypeDescription
business_connection_idStringUnique identifier of the business connection on behalf of which the message will be sent
message_thread_idIntegerUnique 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_idIntegerIdentifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat
durationIntegerDuration of sent video in seconds
lengthIntegerVideo width and height, i.e. diameter of the video message
thumbnailInputFile | StringThumbnail 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_notificationBooleanSends the message silently. Users will receive a notification with no sound.
protect_contentBooleanProtects the contents of the sent message from forwarding and saving
allow_paid_broadcastBooleanPass 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_idStringUnique identifier of the message effect to be added to the message; for private chats only
suggested_post_parametersSuggestedPostParametersA 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_parametersReplyParametersDescription of the message to reply to
reply_markupInlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReplyAdditional 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 ferobot::{Bot, BotError};
use ferobot::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_paid_media()
async → Message +opts

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

chat_idstar_countmedia
FieldTypeDescription
business_connection_idStringUnique identifier of the business connection on behalf of which the message will be sent
message_thread_idIntegerUnique 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_idIntegerIdentifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat
payloadStringBot-defined paid media payload, 0-128 bytes. This will not be displayed to the user, use it for your internal processes.
captionStringMedia caption, 0-1024 characters after entities parsing
parse_modeStringMode for parsing entities in the media caption. See formatting options for more details.
caption_entitiesArray of MessageEntityA JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode
show_caption_above_mediaBooleanPass True, if the caption must be shown above the message media
disable_notificationBooleanSends the message silently. Users will receive a notification with no sound.
protect_contentBooleanProtects the contents of the sent message from forwarding and saving
allow_paid_broadcastBooleanPass 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_parametersSuggestedPostParametersA 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_parametersReplyParametersDescription of the message to reply to
reply_markupInlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReplyAdditional 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 ferobot::{Bot, BotError};
use ferobot::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_media_group()
async → Array of 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_idmedia
FieldTypeDescription
business_connection_idStringUnique identifier of the business connection on behalf of which the message will be sent
message_thread_idIntegerUnique 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_idIntegerIdentifier of the direct messages topic to which the messages will be sent; required if the messages are sent to a direct messages chat
disable_notificationBooleanSends messages silently. Users will receive a notification with no sound.
protect_contentBooleanProtects the contents of the sent messages from forwarding and saving
allow_paid_broadcastBooleanPass 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_idStringUnique identifier of the message effect to be added to the message; for private chats only
reply_parametersReplyParametersDescription of the message to reply to
🔗
use ferobot::{Bot, BotError};
use ferobot::gen_methods::{SendMediaGroupParams};

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

 let chat_id = 123456789i64;
 let media = vec![] // Vec<InputMedia>;
 // 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_location()
async → Message +opts

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

chat_idlatitudelongitude
FieldTypeDescription
business_connection_idStringUnique identifier of the business connection on behalf of which the message will be sent
message_thread_idIntegerUnique 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_idIntegerIdentifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat
horizontal_accuracyFloatThe radius of uncertainty for the location, measured in meters; 0-1500
live_periodIntegerPeriod 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.
headingIntegerFor live locations, a direction in which the user is moving, in degrees. Must be between 1 and 360 if specified.
proximity_alert_radiusIntegerFor live locations, a maximum distance for proximity alerts about approaching another chat member, in meters. Must be between 1 and 100000 if specified.
disable_notificationBooleanSends the message silently. Users will receive a notification with no sound.
protect_contentBooleanProtects the contents of the sent message from forwarding and saving
allow_paid_broadcastBooleanPass 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_idStringUnique identifier of the message effect to be added to the message; for private chats only
suggested_post_parametersSuggestedPostParametersA 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_parametersReplyParametersDescription of the message to reply to
reply_markupInlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReplyAdditional 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 ferobot::{Bot, BotError};
use ferobot::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_venue()
async → Message +opts

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

chat_idlatitudelongitudetitleaddress
FieldTypeDescription
business_connection_idStringUnique identifier of the business connection on behalf of which the message will be sent
message_thread_idIntegerUnique 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_idIntegerIdentifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat
foursquare_idStringFoursquare identifier of the venue
foursquare_typeStringFoursquare type of the venue, if known. (For example, "arts_entertainment/default", "arts_entertainment/aquarium" or "food/icecream".)
google_place_idStringGoogle Places identifier of the venue
google_place_typeStringGoogle Places type of the venue. (See supported types.)
disable_notificationBooleanSends the message silently. Users will receive a notification with no sound.
protect_contentBooleanProtects the contents of the sent message from forwarding and saving
allow_paid_broadcastBooleanPass 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_idStringUnique identifier of the message effect to be added to the message; for private chats only
suggested_post_parametersSuggestedPostParametersA 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_parametersReplyParametersDescription of the message to reply to
reply_markupInlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReplyAdditional 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 ferobot::{Bot, BotError};
use ferobot::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_contact()
async → Message +opts

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

chat_idphone_numberfirst_name
FieldTypeDescription
business_connection_idStringUnique identifier of the business connection on behalf of which the message will be sent
message_thread_idIntegerUnique 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_idIntegerIdentifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat
last_nameStringContact's last name
vcardStringAdditional data about the contact in the form of a vCard, 0-2048 bytes
disable_notificationBooleanSends the message silently. Users will receive a notification with no sound.
protect_contentBooleanProtects the contents of the sent message from forwarding and saving
allow_paid_broadcastBooleanPass 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_idStringUnique identifier of the message effect to be added to the message; for private chats only
suggested_post_parametersSuggestedPostParametersA 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_parametersReplyParametersDescription of the message to reply to
reply_markupInlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReplyAdditional 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 ferobot::{Bot, BotError};
use ferobot::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 = "example";
 // 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_poll()
async → Message +opts

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

chat_idquestionoptions
FieldTypeDescription
business_connection_idStringUnique identifier of the business connection on behalf of which the message will be sent
message_thread_idIntegerUnique 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_modeStringMode for parsing entities in the question. See formatting options for more details. Currently, only custom emoji entities are allowed
question_entitiesArray of MessageEntityA JSON-serialized list of special entities that appear in the poll question. It can be specified instead of question_parse_mode
is_anonymousBooleanTrue, if the poll needs to be anonymous, defaults to True
typeStringPoll type, "quiz" or "regular", defaults to "regular"
allows_multiple_answersBooleanPass True, if the poll allows multiple answers, defaults to False
allows_revotingBooleanPass True, if the poll allows to change chosen answer options, defaults to False for quizzes and to True for regular polls
shuffle_optionsBooleanPass True, if the poll options must be shown in random order
allow_adding_optionsBooleanPass True, if answer options can be added to the poll after creation; not supported for anonymous polls and quizzes
hide_results_until_closesBooleanPass True, if poll results must be shown only after the poll closes
correct_option_idsArray of IntegerA JSON-serialized list of monotonically increasing 0-based identifiers of the correct answer options, required for polls in quiz mode
explanationStringText 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_modeStringMode for parsing entities in the explanation. See formatting options for more details.
explanation_entitiesArray of MessageEntityA JSON-serialized list of special entities that appear in the poll explanation. It can be specified instead of explanation_parse_mode
open_periodIntegerAmount of time in seconds the poll will be active after creation, 5-2628000. Can't be used together with close_date.
close_dateIntegerPoint in time (Unix timestamp) when the poll will be automatically closed. Must be at least 5 and no more than 2628000 seconds in the future. Can't be used together with open_period.
is_closedBooleanPass True if the poll needs to be immediately closed. This can be useful for poll preview.
descriptionStringDescription of the poll to be sent, 0-1024 characters after entities parsing
description_parse_modeStringMode for parsing entities in the poll description. See formatting options for more details.
description_entitiesArray of MessageEntityA JSON-serialized list of special entities that appear in the poll description, which can be specified instead of description_parse_mode
disable_notificationBooleanSends the message silently. Users will receive a notification with no sound.
protect_contentBooleanProtects the contents of the sent message from forwarding and saving
allow_paid_broadcastBooleanPass 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_idStringUnique identifier of the message effect to be added to the message; for private chats only
reply_parametersReplyParametersDescription of the message to reply to
reply_markupInlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReplyAdditional 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 ferobot::{Bot, BotError};
use ferobot::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)
 // ... +21 more optional fields;


 let result = bot.send_poll(
 chat_id,
 question,
 options,
 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_idchecklist
FieldTypeDescription
disable_notificationBooleanSends the message silently. Users will receive a notification with no sound.
protect_contentBooleanProtects the contents of the sent message from forwarding and saving
message_effect_idStringUnique identifier of the message effect to be added to the message
reply_parametersReplyParametersA JSON-serialized object for description of the message to reply to
reply_markupInlineKeyboardMarkupA JSON-serialized object for an inline keyboard
🔗
use ferobot::{Bot, BotError};
use ferobot::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_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_id
FieldTypeDescription
business_connection_idStringUnique identifier of the business connection on behalf of which the message will be sent
message_thread_idIntegerUnique 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_idIntegerIdentifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat
emojiStringEmoji 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_notificationBooleanSends the message silently. Users will receive a notification with no sound.
protect_contentBooleanProtects the contents of the sent message from forwarding
allow_paid_broadcastBooleanPass 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_idStringUnique identifier of the message effect to be added to the message; for private chats only
suggested_post_parametersSuggestedPostParametersA 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_parametersReplyParametersDescription of the message to reply to
reply_markupInlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReplyAdditional 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 ferobot::{Bot, BotError};
use ferobot::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_message_draft()
async → Boolean +opts

Use this method to stream a partial message to a user while the message is being generated. Returns True on success.

chat_iddraft_idtext
FieldTypeDescription
message_thread_idIntegerUnique identifier for the target message thread
parse_modeStringMode for parsing entities in the message text. See formatting options for more details.
entitiesArray of MessageEntityA JSON-serialized list of special entities that appear in message text, which can be specified instead of parse_mode
🔗
use ferobot::{Bot, BotError};
use ferobot::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 ferobot! 🦀";
 // 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_chat_action()
async → Boolean +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_idaction
FieldTypeDescription
business_connection_idStringUnique identifier of the business connection on behalf of which the action will be sent
message_thread_idIntegerUnique 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 ferobot::{Bot, BotError};

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


 let result = bot.send_chat_action().await?;
 println!("Result: {result:?}");
 Ok(())
}
bot.send_gift()
async → Boolean +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_id
FieldTypeDescription
user_idIntegerRequired if chat_id is not specified. Unique identifier of the target user who will receive the gift.
chat_idInteger | StringRequired 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_upgradeBooleanPass True to pay for the gift upgrade from the bot's balance, thereby making the upgrade free for the receiver
textStringText that will be shown along with the gift; 0-128 characters
text_parse_modeStringMode for parsing entities in the text. See formatting options for more details. Entities other than "bold", "italic", "underline", "strikethrough", "spoiler", "custom_emoji", and "date_time" are ignored.
text_entitiesArray of MessageEntityA 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", "custom_emoji", and "date_time" are ignored.
🔗
use ferobot::{Bot, BotError};
use ferobot::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_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_idsticker
FieldTypeDescription
business_connection_idStringUnique identifier of the business connection on behalf of which the message will be sent
message_thread_idIntegerUnique 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_idIntegerIdentifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat
emojiStringEmoji associated with the sticker; only for just uploaded stickers
disable_notificationBooleanSends the message silently. Users will receive a notification with no sound.
protect_contentBooleanProtects the contents of the sent message from forwarding and saving
allow_paid_broadcastBooleanPass 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_idStringUnique identifier of the message effect to be added to the message; for private chats only
suggested_post_parametersSuggestedPostParametersA 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_parametersReplyParametersDescription of the message to reply to
reply_markupInlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReplyAdditional 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 ferobot::{Bot, BotError};
use ferobot::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_invoice()
async → Message +opts

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

chat_idtitledescriptionpayloadcurrencyprices
FieldTypeDescription
message_thread_idIntegerUnique 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_idIntegerIdentifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat
provider_tokenStringPayment provider token, obtained via @BotFather. Pass an empty string for payments in Telegram Stars.
max_tip_amountIntegerThe 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_amountsArray of IntegerA 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_parameterStringUnique 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_dataStringJSON-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_urlStringURL 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_sizeIntegerPhoto size in bytes
photo_widthIntegerPhoto width
photo_heightIntegerPhoto height
need_nameBooleanPass True if you require the user's full name to complete the order. Ignored for payments in Telegram Stars.
need_phone_numberBooleanPass True if you require the user's phone number to complete the order. Ignored for payments in Telegram Stars.
need_emailBooleanPass True if you require the user's email address to complete the order. Ignored for payments in Telegram Stars.
need_shipping_addressBooleanPass True if you require the user's shipping address to complete the order. Ignored for payments in Telegram Stars.
send_phone_number_to_providerBooleanPass True if the user's phone number should be sent to the provider. Ignored for payments in Telegram Stars.
send_email_to_providerBooleanPass True if the user's email address should be sent to the provider. Ignored for payments in Telegram Stars.
is_flexibleBooleanPass True if the final price depends on the shipping method. Ignored for payments in Telegram Stars.
disable_notificationBooleanSends the message silently. Users will receive a notification with no sound.
protect_contentBooleanProtects the contents of the sent message from forwarding and saving
allow_paid_broadcastBooleanPass 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_idStringUnique identifier of the message effect to be added to the message; for private chats only
suggested_post_parametersSuggestedPostParametersA 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_parametersReplyParametersDescription of the message to reply to
reply_markupInlineKeyboardMarkupA 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 ferobot::{Bot, BotError};
use ferobot::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_game()
async → Message +opts

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

chat_idgame_short_name
FieldTypeDescription
business_connection_idStringUnique identifier of the business connection on behalf of which the message will be sent
message_thread_idIntegerUnique 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_notificationBooleanSends the message silently. Users will receive a notification with no sound.
protect_contentBooleanProtects the contents of the sent message from forwarding and saving
allow_paid_broadcastBooleanPass 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_idStringUnique identifier of the message effect to be added to the message; for private chats only
reply_parametersReplyParametersDescription of the message to reply to
reply_markupInlineKeyboardMarkupA 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 ferobot::{Bot, BotError};
use ferobot::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 = "example";
 // 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(())
}

Getting Info

30
bot.get_updates()
async → Array of Update +opts

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

params
FieldTypeDescription
offsetIntegerIdentifier 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.
limitIntegerLimits the number of updates to be retrieved. Values between 1-100 are accepted. Defaults to 100.
timeoutIntegerTimeout 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_updatesArray of StringA 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 ferobot::{Bot, BotError};
use ferobot::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_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 ferobot::{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(())
}
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 ferobot::{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_user_profile_photos()
async → UserProfilePhotos +opts

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

user_id
FieldTypeDescription
offsetIntegerSequential number of the first photo to be returned. By default, all photos are returned.
limitIntegerLimits the number of photos to be retrieved. Values between 1-100 are accepted. Defaults to 100.
🔗
use ferobot::{Bot, BotError};
use ferobot::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_user_profile_audios()
async → UserProfileAudios +opts

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

user_id
FieldTypeDescription
offsetIntegerSequential number of the first audio to be returned. By default, all audios are returned.
limitIntegerLimits the number of audios to be retrieved. Values between 1-100 are accepted. Defaults to 100.
🔗
use ferobot::{Bot, BotError};
use ferobot::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_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 ferobot::{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_chat()
async → ChatFullInfo

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

chat_id
🔗
use ferobot::{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 → Array of 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 ferobot::{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_member_count()
async → Integer

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

chat_id
🔗
use ferobot::{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_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 ferobot::{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_forum_topic_icon_stickers()
async → Array of 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 ferobot::{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_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 ferobot::{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_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 ferobot::{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_managed_bot_token()
async → String

Use this method to get the token of a managed bot. Returns the token as String on success.

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

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

 let user_id = 123456789i64;

 let result = bot.get_managed_bot_token(
 user_id
 ).await?;
 println!("Result: {result:?}");
 Ok(())
}
bot.get_my_commands()
async → Array of 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
scopeBotCommandScopeA JSON-serialized object, describing scope of users. Defaults to BotCommandScopeDefault.
language_codeStringA two-letter ISO 639-1 language code or an empty string
🔗
use ferobot::{Bot, BotError};
use ferobot::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_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_codeStringA two-letter ISO 639-1 language code or an empty string
🔗
use ferobot::{Bot, BotError};
use ferobot::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_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_codeStringA two-letter ISO 639-1 language code or an empty string
🔗
use ferobot::{Bot, BotError};
use ferobot::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_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_codeStringA two-letter ISO 639-1 language code or an empty string
🔗
use ferobot::{Bot, BotError};
use ferobot::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_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_idIntegerUnique identifier for the target private chat. If not specified, default bot's menu button will be returned
🔗
use ferobot::{Bot, BotError};
use ferobot::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_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_channelsBooleanPass 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 ferobot::{Bot, BotError};
use ferobot::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_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 ferobot::{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_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 ferobot::{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_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_id
FieldTypeDescription
exclude_unsavedBooleanPass True to exclude gifts that aren't saved to the account's profile page
exclude_savedBooleanPass True to exclude gifts that are saved to the account's profile page
exclude_unlimitedBooleanPass True to exclude gifts that can be purchased an unlimited number of times
exclude_limited_upgradableBooleanPass True to exclude gifts that can be purchased a limited number of times and can be upgraded to unique
exclude_limited_non_upgradableBooleanPass True to exclude gifts that can be purchased a limited number of times and can't be upgraded to unique
exclude_uniqueBooleanPass True to exclude unique gifts
exclude_from_blockchainBooleanPass True to exclude gifts that were assigned from the TON blockchain and can't be resold or transferred in Telegram
sort_by_priceBooleanPass True to sort results by gift price instead of send date. Sorting is applied before pagination.
offsetStringOffset of the first entry to return as received from the previous request; use empty string to get the first chunk of results
limitIntegerThe maximum number of gifts to be returned; 1-100. Defaults to 100
🔗
use ferobot::{Bot, BotError};
use ferobot::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_user_gifts()
async → OwnedGifts +opts

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

user_id
FieldTypeDescription
exclude_unlimitedBooleanPass True to exclude gifts that can be purchased an unlimited number of times
exclude_limited_upgradableBooleanPass True to exclude gifts that can be purchased a limited number of times and can be upgraded to unique
exclude_limited_non_upgradableBooleanPass True to exclude gifts that can be purchased a limited number of times and can't be upgraded to unique
exclude_from_blockchainBooleanPass True to exclude gifts that were assigned from the TON blockchain and can't be resold or transferred in Telegram
exclude_uniqueBooleanPass True to exclude unique gifts
sort_by_priceBooleanPass True to sort results by gift price instead of send date. Sorting is applied before pagination.
offsetStringOffset of the first entry to return as received from the previous request; use an empty string to get the first chunk of results
limitIntegerThe maximum number of gifts to be returned; 1-100. Defaults to 100
🔗
use ferobot::{Bot, BotError};
use ferobot::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_chat_gifts()
async → OwnedGifts +opts

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

chat_id
FieldTypeDescription
exclude_unsavedBooleanPass 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_savedBooleanPass 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_unlimitedBooleanPass True to exclude gifts that can be purchased an unlimited number of times
exclude_limited_upgradableBooleanPass True to exclude gifts that can be purchased a limited number of times and can be upgraded to unique
exclude_limited_non_upgradableBooleanPass True to exclude gifts that can be purchased a limited number of times and can't be upgraded to unique
exclude_from_blockchainBooleanPass True to exclude gifts that were assigned from the TON blockchain and can't be resold or transferred in Telegram
exclude_uniqueBooleanPass True to exclude unique gifts
sort_by_priceBooleanPass True to sort results by gift price instead of send date. Sorting is applied before pagination.
offsetStringOffset of the first entry to return as received from the previous request; use an empty string to get the first chunk of results
limitIntegerThe maximum number of gifts to be returned; 1-100. Defaults to 100
🔗
use ferobot::{Bot, BotError};
use ferobot::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_sticker_set()
async → StickerSet

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

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

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

 let name = "example";

 let result = bot.get_sticker_set(
 name
 ).await?;
 println!("Result: {result:?}");
 Ok(())
}
bot.get_custom_emoji_stickers()
async → Array of Sticker

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

custom_emoji_ids
🔗
use ferobot::{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_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 ferobot::{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
offsetIntegerNumber of transactions to skip in the response
limitIntegerThe maximum number of transactions to be retrieved. Values between 1-100 are accepted. Defaults to 100.
🔗
use ferobot::{Bot, BotError};
use ferobot::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_game_high_scores()
async → Array of 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_id
FieldTypeDescription
chat_idIntegerRequired if inline_message_id is not specified. Unique identifier for the target chat
message_idIntegerRequired if inline_message_id is not specified. Identifier of the sent message
inline_message_idStringRequired if chat_id and message_id are not specified. Identifier of the inline message
🔗
use ferobot::{Bot, BotError};
use ferobot::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(())
}

Editing

12
bot.edit_forum_topic()
async → Boolean +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_id
FieldTypeDescription
nameStringNew topic name, 0-128 characters. If not specified or empty, the current name of the topic will be kept
icon_custom_emoji_idStringNew 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 ferobot::{Bot, BotError};
use ferobot::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 → Boolean

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 ferobot::{Bot, BotError};

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

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

 let result = bot.edit_general_forum_topic(
 chat_id,
 name
 ).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_idcontent
FieldTypeDescription
captionStringCaption of the story, 0-2048 characters after entities parsing
parse_modeStringMode for parsing entities in the story caption. See formatting options for more details.
caption_entitiesArray of MessageEntityA JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode
areasArray of StoryAreaA JSON-serialized list of clickable areas to be shown on the story
🔗
use ferobot::{Bot, BotError};
use ferobot::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_message_text()
async → Message, Boolean +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.

text
FieldTypeDescription
business_connection_idStringUnique identifier of the business connection on behalf of which the message to be edited was sent
chat_idInteger | StringRequired if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
message_idIntegerRequired if inline_message_id is not specified. Identifier of the message to edit
inline_message_idStringRequired if chat_id and message_id are not specified. Identifier of the inline message
parse_modeStringMode for parsing entities in the message text. See formatting options for more details.
entitiesArray of MessageEntityA JSON-serialized list of special entities that appear in message text, which can be specified instead of parse_mode
link_preview_optionsLinkPreviewOptionsLink preview generation options for the message
reply_markupInlineKeyboardMarkupA JSON-serialized object for an inline keyboard.
🔗
use ferobot::{Bot, BotError};

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


 let result = bot.edit_message_text().await?;
 println!("Result: {result:?}");
 Ok(())
}
bot.edit_message_caption()
async → Message, Boolean +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_idStringUnique identifier of the business connection on behalf of which the message to be edited was sent
chat_idInteger | StringRequired if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
message_idIntegerRequired if inline_message_id is not specified. Identifier of the message to edit
inline_message_idStringRequired if chat_id and message_id are not specified. Identifier of the inline message
captionStringNew caption of the message, 0-1024 characters after entities parsing
parse_modeStringMode for parsing entities in the message caption. See formatting options for more details.
caption_entitiesArray of MessageEntityA JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode
show_caption_above_mediaBooleanPass True, if the caption must be shown above the message media. Supported only for animation, photo and video messages.
reply_markupInlineKeyboardMarkupA JSON-serialized object for an inline keyboard.
🔗
use ferobot::{Bot, BotError};
use ferobot::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_media()
async → Message, Boolean +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.

media
FieldTypeDescription
business_connection_idStringUnique identifier of the business connection on behalf of which the message to be edited was sent
chat_idInteger | StringRequired if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
message_idIntegerRequired if inline_message_id is not specified. Identifier of the message to edit
inline_message_idStringRequired if chat_id and message_id are not specified. Identifier of the inline message
reply_markupInlineKeyboardMarkupA JSON-serialized object for a new inline keyboard.
🔗
use ferobot::{Bot, BotError};
use ferobot::gen_methods::{EditMessageMediaParams};

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

 let media = vec![] // Vec<InputMedia>;
 // 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_live_location()
async → Message, Boolean +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.

latitudelongitude
FieldTypeDescription
business_connection_idStringUnique identifier of the business connection on behalf of which the message to be edited was sent
chat_idInteger | StringRequired if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
message_idIntegerRequired if inline_message_id is not specified. Identifier of the message to edit
inline_message_idStringRequired if chat_id and message_id are not specified. Identifier of the inline message
live_periodIntegerNew 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_accuracyFloatThe radius of uncertainty for the location, measured in meters; 0-1500
headingIntegerDirection in which the user is moving, in degrees. Must be between 1 and 360 if specified.
proximity_alert_radiusIntegerThe maximum distance for proximity alerts about approaching another chat member, in meters. Must be between 1 and 100000 if specified.
reply_markupInlineKeyboardMarkupA JSON-serialized object for a new inline keyboard.
🔗
use ferobot::{Bot, BotError};
use ferobot::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_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_idchecklist
FieldTypeDescription
reply_markupInlineKeyboardMarkupA JSON-serialized object for the new inline keyboard for the message
🔗
use ferobot::{Bot, BotError};
use ferobot::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_reply_markup()
async → Message, Boolean +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_idStringUnique identifier of the business connection on behalf of which the message to be edited was sent
chat_idInteger | StringRequired if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
message_idIntegerRequired if inline_message_id is not specified. Identifier of the message to edit
inline_message_idStringRequired if chat_id and message_id are not specified. Identifier of the inline message
reply_markupInlineKeyboardMarkupA JSON-serialized object for an inline keyboard.
🔗
use ferobot::{Bot, BotError};
use ferobot::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_user_star_subscription()
async → Boolean

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 ferobot::{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_webhook()
async → Boolean +opts

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

params
FieldTypeDescription
drop_pending_updatesBooleanPass True to drop all pending updates
🔗
use ferobot::{Bot, BotError};
use ferobot::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(())
}
bot.delete_chat_photo()
async → Boolean

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 ferobot::{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 → Boolean

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 ferobot::{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 → Boolean

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 ferobot::{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_my_commands()
async → Boolean +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
scopeBotCommandScopeA JSON-serialized object, describing scope of users for which the commands are relevant. Defaults to BotCommandScopeDefault.
language_codeStringA 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 ferobot::{Bot, BotError};
use ferobot::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_business_messages()
async → Boolean

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 ferobot::{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_story()
async → Boolean

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 ferobot::{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_message()
async → Boolean

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 ferobot::{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 → Boolean

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 ferobot::{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_sticker_from_set()
async → Boolean

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

sticker
🔗
use ferobot::{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 → Boolean

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

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

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

 let name = "example";

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

Forwarding & Copying

4
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_id
FieldTypeDescription
message_thread_idIntegerUnique 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_idIntegerIdentifier 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_timestampIntegerNew start timestamp for the forwarded video in the message
disable_notificationBooleanSends the message silently. Users will receive a notification with no sound.
protect_contentBooleanProtects the contents of the forwarded message from forwarding and saving
message_effect_idStringUnique identifier of the message effect to be added to the message; only available when forwarding to private chats
suggested_post_parametersSuggestedPostParametersA JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only
🔗
use ferobot::{Bot, BotError};

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


 let result = bot.forward_message().await?;
 println!("Result: {result:?}");
 Ok(())
}
bot.forward_messages()
async → Array of 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_ids
FieldTypeDescription
message_thread_idIntegerUnique 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_idIntegerIdentifier of the direct messages topic to which the messages will be forwarded; required if the messages are forwarded to a direct messages chat
disable_notificationBooleanSends the messages silently. Users will receive a notification with no sound.
protect_contentBooleanProtects the contents of the forwarded messages from forwarding and saving
🔗
use ferobot::{Bot, BotError};
use ferobot::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(())
}
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_id
FieldTypeDescription
message_thread_idIntegerUnique 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_idIntegerIdentifier 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_timestampIntegerNew start timestamp for the copied video in the message
captionStringNew caption for media, 0-1024 characters after entities parsing. If not specified, the original caption is kept
parse_modeStringMode for parsing entities in the new caption. See formatting options for more details.
caption_entitiesArray of MessageEntityA JSON-serialized list of special entities that appear in the new caption, which can be specified instead of parse_mode
show_caption_above_mediaBooleanPass True, if the caption must be shown above the message media. Ignored if a new caption isn't specified.
disable_notificationBooleanSends the message silently. Users will receive a notification with no sound.
protect_contentBooleanProtects the contents of the sent message from forwarding and saving
allow_paid_broadcastBooleanPass 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_idStringUnique identifier of the message effect to be added to the message; only available when copying to private chats
suggested_post_parametersSuggestedPostParametersA 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_parametersReplyParametersDescription of the message to reply to
reply_markupInlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReplyAdditional 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 ferobot::{Bot, BotError};

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


 let result = bot.copy_message().await?;
 println!("Result: {result:?}");
 Ok(())
}
bot.copy_messages()
async → Array of 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_ids
FieldTypeDescription
message_thread_idIntegerUnique 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_idIntegerIdentifier of the direct messages topic to which the messages will be sent; required if the messages are sent to a direct messages chat
disable_notificationBooleanSends the messages silently. Users will receive a notification with no sound.
protect_contentBooleanProtects the contents of the sent messages from forwarding and saving
remove_captionBooleanPass True to copy the messages without their captions
🔗
use ferobot::{Bot, BotError};
use ferobot::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(())
}

Answering Queries

5
bot.answer_callback_query()
async → Boolean +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_id
FieldTypeDescription
textStringText of the notification. If not specified, nothing will be shown to the user, 0-200 characters
show_alertBooleanIf True, an alert will be shown by the client instead of a notification at the top of the chat screen. Defaults to false.
urlStringURL 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_timeIntegerThe 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 ferobot::{Bot, BotError};

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


 let result = bot.answer_callback_query().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 ferobot::{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(())
}
bot.answer_inline_query()
async → Boolean +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_idresults
FieldTypeDescription
cache_timeIntegerThe maximum amount of time in seconds that the result of the inline query may be cached on the server. Defaults to 300.
is_personalBooleanPass 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_offsetStringPass 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.
buttonInlineQueryResultsButtonA JSON-serialized object describing a button to be shown above inline query results
🔗
use ferobot::{Bot, BotError};
use ferobot::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_shipping_query()
async → Boolean +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_idok
FieldTypeDescription
shipping_optionsArray of ShippingOptionRequired if ok is True. A JSON-serialized array of available shipping options.
error_messageStringRequired 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 ferobot::{Bot, BotError};
use ferobot::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_pre_checkout_query()
async → Boolean +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_idok
FieldTypeDescription
error_messageStringRequired 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 ferobot::{Bot, BotError};
use ferobot::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(())
}

Chat Administration

6
bot.ban_chat_member()
async → Boolean +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_id
FieldTypeDescription
until_dateIntegerDate 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_messagesBooleanPass 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 ferobot::{Bot, BotError};
use ferobot::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.unban_chat_member()
async → Boolean +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_id
FieldTypeDescription
only_if_bannedBooleanDo nothing if the user is not banned
🔗
use ferobot::{Bot, BotError};
use ferobot::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.restrict_chat_member()
async → Boolean +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_idpermissions
FieldTypeDescription
use_independent_chat_permissionsBooleanPass 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_dateIntegerDate 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 ferobot::{Bot, BotError};
use ferobot::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.promote_chat_member()
async → Boolean +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_id
FieldTypeDescription
is_anonymousBooleanPass True if the administrator's presence in the chat is hidden
can_manage_chatBooleanPass 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_messagesBooleanPass True if the administrator can delete messages of other users
can_manage_video_chatsBooleanPass True if the administrator can manage video chats
can_restrict_membersBooleanPass 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_membersBooleanPass 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_infoBooleanPass True if the administrator can change chat title, photo and other settings
can_invite_usersBooleanPass True if the administrator can invite new users to the chat
can_post_storiesBooleanPass True if the administrator can post stories to the chat
can_edit_storiesBooleanPass 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_storiesBooleanPass True if the administrator can delete stories posted by other users
can_post_messagesBooleanPass True if the administrator can post messages in the channel, approve suggested posts, or access channel statistics; for channels only
can_edit_messagesBooleanPass True if the administrator can edit messages of other users and can pin messages; for channels only
can_pin_messagesBooleanPass True if the administrator can pin messages; for supergroups only
can_manage_topicsBooleanPass True if the user is allowed to create, rename, close, and reopen forum topics; for supergroups only
can_manage_direct_messagesBooleanPass True if the administrator can manage direct messages within the channel and decline suggested posts; for channels only
can_manage_tagsBooleanPass True if the administrator can edit the tags of regular members; for groups and supergroups only
🔗
use ferobot::{Bot, BotError};
use ferobot::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)
 // ... +12 more optional fields;


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

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 ferobot::{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.unban_chat_sender_chat()
async → Boolean

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 ferobot::{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 → Boolean

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 ferobot::{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.decline_chat_join_request()
async → Boolean

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 ferobot::{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.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_idname
FieldTypeDescription
icon_colorIntegerColor 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_idStringUnique identifier of the custom emoji shown as the topic icon. Use getForumTopicIconStickers to get all allowed custom emoji identifiers.
🔗
use ferobot::{Bot, BotError};
use ferobot::gen_methods::{CreateForumTopicParams};

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

 let chat_id = 123456789i64;
 let name = "example";
 // 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.approve_suggested_post()
async → Boolean +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_id
FieldTypeDescription
send_dateIntegerPoint 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 ferobot::{Bot, BotError};
use ferobot::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.decline_suggested_post()
async → Boolean +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_id
FieldTypeDescription
commentStringComment for the creator of the suggested post; 0-128 characters
🔗
use ferobot::{Bot, BotError};
use ferobot::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(())
}
bot.create_new_sticker_set()
async → Boolean +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_idnametitlestickers
FieldTypeDescription
sticker_typeStringType of stickers in the set, pass "regular", "mask", or "custom_emoji". By default, a regular sticker set is created.
needs_repaintingBooleanPass 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 ferobot::{Bot, BotError};
use ferobot::gen_methods::{CreateNewStickerSetParams};

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

 let user_id = 123456789i64;
 let name = "example";
 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(())
}

Pinning

5
bot.pin_chat_message()
async → Boolean +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_id
FieldTypeDescription
business_connection_idStringUnique identifier of the business connection on behalf of which the message will be pinned
disable_notificationBooleanPass 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 ferobot::{Bot, BotError};

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


 let result = bot.pin_chat_message().await?;
 println!("Result: {result:?}");
 Ok(())
}
bot.unpin_chat_message()
async → Boolean +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_id
FieldTypeDescription
business_connection_idStringUnique identifier of the business connection on behalf of which the message will be unpinned
message_idIntegerIdentifier 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 ferobot::{Bot, BotError};
use ferobot::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(())
}
bot.unpin_all_chat_messages()
async → Boolean

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 ferobot::{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 → Boolean

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 ferobot::{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 → Boolean

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 ferobot::{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(())
}

Configuration

31
bot.set_webhook()
async → Boolean +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.

url
FieldTypeDescription
certificateInputFileUpload your public key certificate so that the root certificate in use can be checked. See our self-signed guide for details.
ip_addressStringThe fixed IP address which will be used to send webhook requests instead of the IP address resolved through DNS
max_connectionsIntegerThe 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_updatesArray of StringA 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_updatesBooleanPass True to drop all pending updates
secret_tokenStringA 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 ferobot::{Bot, BotError};
use ferobot::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(())
}
bot.set_message_reaction()
async → Boolean +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_id
FieldTypeDescription
reactionArray of ReactionTypeA 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_bigBooleanPass True to set the reaction with a big animation
🔗
use ferobot::{Bot, BotError};
use ferobot::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_user_emoji_status()
async → Boolean +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_id
FieldTypeDescription
emoji_status_custom_emoji_idStringCustom emoji identifier of the emoji status to set. Pass an empty string to remove the status.
emoji_status_expiration_dateIntegerExpiration date of the emoji status, if any
🔗
use ferobot::{Bot, BotError};
use ferobot::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_chat_administrator_custom_title()
async → Boolean

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 ferobot::{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_member_tag()
async → Boolean +opts

Use this method to set a tag for a regular member in a group or a supergroup. The bot must be an administrator in the chat for this to work and must have the can_manage_tags administrator right. Returns True on success.

chat_iduser_id
FieldTypeDescription
tagStringNew tag for the member; 0-16 characters, emoji are not allowed
🔗
use ferobot::{Bot, BotError};
use ferobot::gen_methods::{SetChatMemberTagParams};

#[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 = SetChatMemberTagParams::new()
 .tag(None);


 let result = bot.set_chat_member_tag(
 chat_id,
 user_id,
 Some(params)
 ).await?;
 println!("Result: {result:?}");
 Ok(())
}
bot.set_chat_permissions()
async → Boolean +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_idpermissions
FieldTypeDescription
use_independent_chat_permissionsBooleanPass 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 ferobot::{Bot, BotError};
use ferobot::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 → Boolean

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 ferobot::{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_title()
async → Boolean

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 ferobot::{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_chat_description()
async → Boolean +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_id
FieldTypeDescription
descriptionStringNew chat description, 0-255 characters
🔗
use ferobot::{Bot, BotError};
use ferobot::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_sticker_set()
async → Boolean

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 ferobot::{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 = "example";

 let result = bot.set_chat_sticker_set(
 chat_id,
 sticker_set_name
 ).await?;
 println!("Result: {result:?}");
 Ok(())
}
bot.set_my_commands()
async → Boolean +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.

commands
FieldTypeDescription
scopeBotCommandScopeA JSON-serialized object, describing scope of users for which the commands are relevant. Defaults to BotCommandScopeDefault.
language_codeStringA 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 ferobot::{Bot, BotError};
use ferobot::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_name()
async → Boolean +opts

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

params
FieldTypeDescription
nameStringNew bot name; 0-64 characters. Pass an empty string to remove the dedicated name for the given language.
language_codeStringA 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 ferobot::{Bot, BotError};
use ferobot::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_description()
async → Boolean +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
descriptionStringNew bot description; 0-512 characters. Pass an empty string to remove the dedicated description for the given language.
language_codeStringA 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 ferobot::{Bot, BotError};
use ferobot::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_short_description()
async → Boolean +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_descriptionStringNew short description for the bot; 0-120 characters. Pass an empty string to remove the dedicated short description for the given language.
language_codeStringA 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 ferobot::{Bot, BotError};
use ferobot::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_my_profile_photo()
async → Boolean

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

photo
🔗
use ferobot::{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_chat_menu_button()
async → Boolean +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_idIntegerUnique identifier for the target private chat. If not specified, default bot's menu button will be changed
menu_buttonMenuButtonA JSON-serialized object for the bot's new menu button. Defaults to MenuButtonDefault
🔗
use ferobot::{Bot, BotError};
use ferobot::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_my_default_administrator_rights()
async → Boolean +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
rightsChatAdministratorRightsA JSON-serialized object describing new default administrator rights. If not specified, the default administrator rights will be cleared.
for_channelsBooleanPass 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 ferobot::{Bot, BotError};
use ferobot::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_business_account_name()
async → Boolean +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_name
FieldTypeDescription
last_nameStringThe new value of the last name for the business account; 0-64 characters
🔗
use ferobot::{Bot, BotError};
use ferobot::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 = "example";
 // 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_username()
async → Boolean +opts

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

business_connection_id
FieldTypeDescription
usernameStringThe new value of the username for the business account; 0-32 characters
🔗
use ferobot::{Bot, BotError};
use ferobot::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_business_account_bio()
async → Boolean +opts

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

business_connection_id
FieldTypeDescription
bioStringThe new value of the bio for the business account; 0-140 characters
🔗
use ferobot::{Bot, BotError};
use ferobot::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_profile_photo()
async → Boolean +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_idphoto
FieldTypeDescription
is_publicBooleanPass 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 ferobot::{Bot, BotError};
use ferobot::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_gift_settings()
async → Boolean

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 ferobot::{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_sticker_position_in_set()
async → Boolean

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

stickerposition
🔗
use ferobot::{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_emoji_list()
async → Boolean

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 ferobot::{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 → Boolean +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.

sticker
FieldTypeDescription
keywordsArray of StringA JSON-serialized list of 0-20 search keywords for the sticker with total length of up to 64 characters
🔗
use ferobot::{Bot, BotError};
use ferobot::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 → Boolean +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.

sticker
FieldTypeDescription
mask_positionMaskPositionA JSON-serialized object with the position where the mask should be placed on faces. Omit the parameter to remove the mask position.
🔗
use ferobot::{Bot, BotError};
use ferobot::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_set_title()
async → Boolean

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

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

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

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

 let result = bot.set_sticker_set_title(
 name,
 title
 ).await?;
 println!("Result: {result:?}");
 Ok(())
}
bot.set_sticker_set_thumbnail()
async → Boolean +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_idformat
FieldTypeDescription
thumbnailInputFile | StringA .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 ferobot::{Bot, BotError};
use ferobot::gen_methods::{SetStickerSetThumbnailParams};

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

 let name = "example";
 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_custom_emoji_sticker_set_thumbnail()
async → Boolean +opts

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

name
FieldTypeDescription
custom_emoji_idStringCustom 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 ferobot::{Bot, BotError};
use ferobot::gen_methods::{SetCustomEmojiStickerSetThumbnailParams};

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

 let name = "example";
 // 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_passport_data_errors()
async → Boolean

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 ferobot::{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_game_score()
async → Message, Boolean +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_idscore
FieldTypeDescription
forceBooleanPass True if the high score is allowed to decrease. This can be useful when fixing mistakes or banning cheaters
disable_edit_messageBooleanPass True if the game message should not be automatically edited to include the current scoreboard
chat_idIntegerRequired if inline_message_id is not specified. Unique identifier for the target chat
message_idIntegerRequired if inline_message_id is not specified. Identifier of the sent message
inline_message_idStringRequired if chat_id and message_id are not specified. Identifier of the inline message
🔗
use ferobot::{Bot, BotError};
use ferobot::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(())
}

Updates & Webhook

1
bot.close()
async → Boolean

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 ferobot::{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.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 ferobot::{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(())
}
bot.add_sticker_to_set()
async → Boolean

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 ferobot::{Bot, BotError};

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

 let user_id = 123456789i64;
 let name = "example";
 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 → Boolean

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 ferobot::{Bot, BotError};

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

 let user_id = 123456789i64;
 let name = "example";
 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(())
}

Forum Topics

6
bot.close_forum_topic()
async → Boolean

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 ferobot::{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.reopen_forum_topic()
async → Boolean

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 ferobot::{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.close_general_forum_topic()
async → Boolean

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 ferobot::{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.reopen_general_forum_topic()
async → Boolean

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 ferobot::{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.hide_general_forum_topic()
async → Boolean

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 ferobot::{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.unhide_general_forum_topic()
async → Boolean

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 ferobot::{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.gift_premium_subscription()
async → Boolean +opts

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

user_idmonth_countstar_count
FieldTypeDescription
textStringText that will be shown along with the service message about the subscription; 0-128 characters
text_parse_modeStringMode for parsing entities in the text. See formatting options for more details. Entities other than "bold", "italic", "underline", "strikethrough", "spoiler", "custom_emoji", and "date_time" are ignored.
text_entitiesArray of MessageEntityA 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", "custom_emoji", and "date_time" are ignored.
🔗
use ferobot::{Bot, BotError};
use ferobot::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.transfer_business_account_stars()
async → Boolean

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 ferobot::{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.convert_gift_to_stars()
async → Boolean

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 ferobot::{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.upgrade_gift()
async → Boolean +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_id
FieldTypeDescription
keep_original_detailsBooleanPass True to keep the original gift text, sender and receiver in the upgraded gift
star_countIntegerThe 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 ferobot::{Bot, BotError};
use ferobot::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(())
}
bot.transfer_gift()
async → Boolean +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_id
FieldTypeDescription
star_countIntegerThe 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 ferobot::{Bot, BotError};
use ferobot::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.refund_star_payment()
async → Boolean

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

user_idtelegram_payment_charge_id
🔗
use ferobot::{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(())
}

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_period
FieldTypeDescription
captionStringCaption of the story, 0-2048 characters after entities parsing
parse_modeStringMode for parsing entities in the story caption. See formatting options for more details.
caption_entitiesArray of MessageEntityA JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode
areasArray of StoryAreaA JSON-serialized list of clickable areas to be shown on the story
post_to_chat_pageBooleanPass True to keep the story accessible after it expires
protect_contentBooleanPass True if the content of the story must be protected from forwarding and screenshotting
🔗
use ferobot::{Bot, BotError};
use ferobot::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_period
FieldTypeDescription
post_to_chat_pageBooleanPass True to keep the story accessible after it expires
protect_contentBooleanPass True if the content of the story must be protected from forwarding and screenshotting
🔗
use ferobot::{Bot, BotError};
use ferobot::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 → Boolean

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 ferobot::{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 → Boolean +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_id
FieldTypeDescription
is_publicBooleanPass 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 ferobot::{Bot, BotError};
use ferobot::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

13
bot.log_out()
async → Boolean

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 ferobot::{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.leave_chat()
async → Boolean

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

chat_id
🔗
use ferobot::{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.replace_managed_bot_token()
async → String

Use this method to revoke the current token of a managed bot and generate a new one. Returns the new token as String on success.

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

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

 let user_id = 123456789i64;

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

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

no parameters
🔗
use ferobot::{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.verify_user()
async → Boolean +opts

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

user_id
FieldTypeDescription
custom_descriptionStringCustom description for the verification; 0-70 characters. Must be empty if the organization isn't allowed to provide a custom verification description.
🔗
use ferobot::{Bot, BotError};
use ferobot::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(())
}
bot.verify_chat()
async → Boolean +opts

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

chat_id
FieldTypeDescription
custom_descriptionStringCustom description for the verification; 0-70 characters. Must be empty if the organization isn't allowed to provide a custom verification description.
🔗
use ferobot::{Bot, BotError};
use ferobot::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.remove_user_verification()
async → Boolean

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 ferobot::{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.remove_chat_verification()
async → Boolean

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 ferobot::{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.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_idresult
FieldTypeDescription
allow_user_chatsBooleanPass True if the message can be sent to private chats with users
allow_bot_chatsBooleanPass True if the message can be sent to private chats with bots
allow_group_chatsBooleanPass True if the message can be sent to group and supergroup chats
allow_channel_chatsBooleanPass True if the message can be sent to channel chats
🔗
use ferobot::{Bot, BotError};
use ferobot::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.save_prepared_keyboard_button()
async → PreparedKeyboardButton

Stores a keyboard button that can be used by a user within a Mini App. Returns a PreparedKeyboardButton object.

user_idbutton
🔗
use ferobot::{Bot, BotError};

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

 let user_id = 123456789i64;
 let button = KeyboardButton::default();

 let result = bot.save_prepared_keyboard_button(
 user_id,
 button
 ).await?;
 println!("Result: {result:?}");
 Ok(())
}
bot.stop_message_live_location()
async → Message, Boolean +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_idStringUnique identifier of the business connection on behalf of which the message to be edited was sent
chat_idInteger | StringRequired if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
message_idIntegerRequired if inline_message_id is not specified. Identifier of the message with live location to stop
inline_message_idStringRequired if chat_id and message_id are not specified. Identifier of the inline message
reply_markupInlineKeyboardMarkupA JSON-serialized object for a new inline keyboard.
🔗
use ferobot::{Bot, BotError};
use ferobot::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_id
FieldTypeDescription
business_connection_idStringUnique identifier of the business connection on behalf of which the message to be edited was sent
reply_markupInlineKeyboardMarkupA JSON-serialized object for a new message inline keyboard.
🔗
use ferobot::{Bot, BotError};
use ferobot::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(())
}

Types Reference

All 270 Telegram types, every field shown. See docs.rs for full rustdoc.

Update 25
update_idInteger
messageMessage
edited_messageMessage
channel_postMessage
edited_channel_postMessage
business_connectionBusinessConnection
business_messageMessage
edited_business_messageMessage
deleted_business_messagesBusinessMessagesDeleted
message_reactionMessageReactionUpdated
message_reaction_countMessageReactionCountUpdated
inline_queryInlineQuery
chosen_inline_resultChosenInlineResult
callback_queryCallbackQuery
shipping_queryShippingQuery
pre_checkout_queryPreCheckoutQuery
purchased_paid_mediaPaidMediaPurchased
pollPoll
poll_answerPollAnswer
my_chat_memberChatMemberUpdated
chat_memberChatMemberUpdated
chat_join_requestChatJoinRequest
chat_boostChatBoostUpdated
removed_chat_boostChatBoostRemoved
managed_botManagedBotUpdated
WebhookInfo 9
urlString
has_custom_certificateBoolean
pending_update_countInteger
ip_addressString
last_error_dateInteger
last_error_messageString
last_synchronization_error_dateInteger
max_connectionsInteger
allowed_updatesArray of String
User 16
idInteger
is_botBoolean
first_nameString
last_nameString
usernameString
language_codeString
is_premiumBoolean
added_to_attachment_menuBoolean
can_join_groupsBoolean
can_read_all_group_messagesBoolean
supports_inline_queriesBoolean
can_connect_to_businessBoolean
has_main_web_appBoolean
has_topics_enabledBoolean
allows_users_to_create_topicsBoolean
can_manage_botsBoolean
Chat 8
idInteger
typeString
titleString
usernameString
first_nameString
last_nameString
is_forumBoolean
is_direct_messagesBoolean
ChatFullInfo 51
idInteger
typeString
titleString
usernameString
first_nameString
last_nameString
is_forumBoolean
is_direct_messagesBoolean
accent_color_idInteger
max_reaction_countInteger
photoChatPhoto
active_usernamesArray of String
birthdateBirthdate
business_introBusinessIntro
business_locationBusinessLocation
business_opening_hoursBusinessOpeningHours
personal_chatChat
parent_chatChat
available_reactionsArray of ReactionType
background_custom_emoji_idString
profile_accent_color_idInteger
profile_background_custom_emoji_idString
emoji_status_custom_emoji_idString
emoji_status_expiration_dateInteger
bioString
has_private_forwardsBoolean
has_restricted_voice_and_video_messagesBoolean
join_to_send_messagesBoolean
join_by_requestBoolean
descriptionString
invite_linkString
pinned_messageMessage
permissionsChatPermissions
accepted_gift_typesAcceptedGiftTypes
can_send_paid_mediaBoolean
slow_mode_delayInteger
unrestrict_boost_countInteger
message_auto_delete_timeInteger
has_aggressive_anti_spam_enabledBoolean
has_hidden_membersBoolean
has_protected_contentBoolean
has_visible_historyBoolean
sticker_set_nameString
can_set_sticker_setBoolean
custom_emoji_sticker_set_nameString
linked_chat_idInteger
locationChatLocation
ratingUserRating
first_profile_audioAudio
unique_gift_colorsUniqueGiftColors
paid_message_star_countInteger
Message 110
message_idInteger
message_thread_idInteger
direct_messages_topicDirectMessagesTopic
fromUser
sender_chatChat
sender_boost_countInteger
sender_business_botUser
sender_tagString
dateInteger
business_connection_idString
chatChat
forward_originMessageOrigin
is_topic_messageBoolean
is_automatic_forwardBoolean
reply_to_messageMessage
external_replyExternalReplyInfo
quoteTextQuote
reply_to_storyStory
reply_to_checklist_task_idInteger
reply_to_poll_option_idString
via_botUser
edit_dateInteger
has_protected_contentBoolean
is_from_offlineBoolean
is_paid_postBoolean
media_group_idString
author_signatureString
paid_star_countInteger
textString
entitiesArray of MessageEntity
link_preview_optionsLinkPreviewOptions
suggested_post_infoSuggestedPostInfo
effect_idString
animationAnimation
audioAudio
documentDocument
paid_mediaPaidMediaInfo
photoArray of PhotoSize
stickerSticker
storyStory
videoVideo
video_noteVideoNote
voiceVoice
captionString
caption_entitiesArray of MessageEntity
show_caption_above_mediaBoolean
has_media_spoilerBoolean
checklistChecklist
contactContact
diceDice
gameGame
pollPoll
venueVenue
locationLocation
new_chat_membersArray of User
left_chat_memberUser
chat_owner_leftChatOwnerLeft
chat_owner_changedChatOwnerChanged
new_chat_titleString
new_chat_photoArray of PhotoSize
delete_chat_photoBoolean
group_chat_createdBoolean
supergroup_chat_createdBoolean
channel_chat_createdBoolean
message_auto_delete_timer_changedMessageAutoDeleteTimerChanged
migrate_to_chat_idInteger
migrate_from_chat_idInteger
pinned_messageMaybeInaccessibleMessage
invoiceInvoice
successful_paymentSuccessfulPayment
refunded_paymentRefundedPayment
users_sharedUsersShared
chat_sharedChatShared
giftGiftInfo
unique_giftUniqueGiftInfo
gift_upgrade_sentGiftInfo
connected_websiteString
write_access_allowedWriteAccessAllowed
passport_dataPassportData
proximity_alert_triggeredProximityAlertTriggered
boost_addedChatBoostAdded
chat_background_setChatBackground
checklist_tasks_doneChecklistTasksDone
checklist_tasks_addedChecklistTasksAdded
direct_message_price_changedDirectMessagePriceChanged
forum_topic_createdForumTopicCreated
forum_topic_editedForumTopicEdited
forum_topic_closedForumTopicClosed
forum_topic_reopenedForumTopicReopened
general_forum_topic_hiddenGeneralForumTopicHidden
general_forum_topic_unhiddenGeneralForumTopicUnhidden
giveaway_createdGiveawayCreated
giveawayGiveaway
giveaway_winnersGiveawayWinners
giveaway_completedGiveawayCompleted
managed_bot_createdManagedBotCreated
paid_message_price_changedPaidMessagePriceChanged
poll_option_addedPollOptionAdded
poll_option_deletedPollOptionDeleted
suggested_post_approvedSuggestedPostApproved
suggested_post_approval_failedSuggestedPostApprovalFailed
suggested_post_declinedSuggestedPostDeclined
suggested_post_paidSuggestedPostPaid
suggested_post_refundedSuggestedPostRefunded
video_chat_scheduledVideoChatScheduled
video_chat_startedVideoChatStarted
video_chat_endedVideoChatEnded
video_chat_participants_invitedVideoChatParticipantsInvited
web_app_dataWebAppData
reply_markupInlineKeyboardMarkup
MessageId 1
message_idInteger
InaccessibleMessage 3
chatChat
message_idInteger
dateInteger
MessageEntity 9
typeString
offsetInteger
lengthInteger
urlString
userUser
languageString
custom_emoji_idString
unix_timeInteger
date_time_formatString
TextQuote 4
textString
entitiesArray of MessageEntity
positionInteger
is_manualBoolean
ExternalReplyInfo 25
originMessageOrigin
chatChat
message_idInteger
link_preview_optionsLinkPreviewOptions
animationAnimation
audioAudio
documentDocument
paid_mediaPaidMediaInfo
photoArray of PhotoSize
stickerSticker
storyStory
videoVideo
video_noteVideoNote
voiceVoice
has_media_spoilerBoolean
checklistChecklist
contactContact
diceDice
gameGame
giveawayGiveaway
giveaway_winnersGiveawayWinners
invoiceInvoice
locationLocation
pollPoll
venueVenue
ReplyParameters 9
message_idInteger
chat_idInteger | String
allow_sending_without_replyBoolean
quoteString
quote_parse_modeString
quote_entitiesArray of MessageEntity
quote_positionInteger
checklist_task_idInteger
poll_option_idString
MessageOriginUser 3
typeString
dateInteger
sender_userUser
MessageOriginHiddenUser 3
typeString
dateInteger
sender_user_nameString
MessageOriginChat 4
typeString
dateInteger
sender_chatChat
author_signatureString
MessageOriginChannel 5
typeString
dateInteger
chatChat
message_idInteger
author_signatureString
PhotoSize 5
file_idString
file_unique_idString
widthInteger
heightInteger
file_sizeInteger
Animation 9
file_idString
file_unique_idString
widthInteger
heightInteger
durationInteger
thumbnailPhotoSize
file_nameString
mime_typeString
file_sizeInteger
Audio 9
file_idString
file_unique_idString
durationInteger
performerString
titleString
file_nameString
mime_typeString
file_sizeInteger
thumbnailPhotoSize
Document 6
file_idString
file_unique_idString
thumbnailPhotoSize
file_nameString
mime_typeString
file_sizeInteger
Story 2
chatChat
idInteger
VideoQuality 6
file_idString
file_unique_idString
widthInteger
heightInteger
codecString
file_sizeInteger
Video 12
file_idString
file_unique_idString
widthInteger
heightInteger
durationInteger
thumbnailPhotoSize
coverArray of PhotoSize
start_timestampInteger
qualitiesArray of VideoQuality
file_nameString
mime_typeString
file_sizeInteger
VideoNote 6
file_idString
file_unique_idString
lengthInteger
durationInteger
thumbnailPhotoSize
file_sizeInteger
Voice 5
file_idString
file_unique_idString
durationInteger
mime_typeString
file_sizeInteger
PaidMediaInfo 2
star_countInteger
paid_mediaArray of PaidMedia
PaidMediaPreview 4
typeString
widthInteger
heightInteger
durationInteger
PaidMediaPhoto 2
typeString
photoArray of PhotoSize
PaidMediaVideo 2
typeString
videoVideo
Contact 5
phone_numberString
first_nameString
last_nameString
user_idInteger
vcardString
Dice 2
emojiString
valueInteger
PollOption 7
persistent_idString
textString
text_entitiesArray of MessageEntity
voter_countInteger
added_by_userUser
added_by_chatChat
addition_dateInteger
InputPollOption 3
textString
text_parse_modeString
text_entitiesArray of MessageEntity
PollAnswer 5
poll_idString
voter_chatChat
userUser
option_idsArray of Integer
option_persistent_idsArray of String
Poll 17
idString
questionString
question_entitiesArray of MessageEntity
optionsArray of PollOption
total_voter_countInteger
is_closedBoolean
is_anonymousBoolean
typeString
allows_multiple_answersBoolean
allows_revotingBoolean
correct_option_idsArray of Integer
explanationString
explanation_entitiesArray of MessageEntity
open_periodInteger
close_dateInteger
descriptionString
description_entitiesArray of MessageEntity
ChecklistTask 6
idInteger
textString
text_entitiesArray of MessageEntity
completed_by_userUser
completed_by_chatChat
completion_dateInteger
Checklist 5
titleString
title_entitiesArray of MessageEntity
tasksArray of ChecklistTask
others_can_add_tasksBoolean
others_can_mark_tasks_as_doneBoolean
InputChecklistTask 4
idInteger
textString
parse_modeString
text_entitiesArray of MessageEntity
InputChecklist 6
titleString
parse_modeString
title_entitiesArray of MessageEntity
tasksArray of InputChecklistTask
others_can_add_tasksBoolean
others_can_mark_tasks_as_doneBoolean
ChecklistTasksDone 3
checklist_messageMessage
marked_as_done_task_idsArray of Integer
marked_as_not_done_task_idsArray of Integer
ChecklistTasksAdded 2
checklist_messageMessage
tasksArray of ChecklistTask
Location 6
latitudeFloat
longitudeFloat
horizontal_accuracyFloat
live_periodInteger
headingInteger
proximity_alert_radiusInteger
Venue 7
locationLocation
titleString
addressString
foursquare_idString
foursquare_typeString
google_place_idString
google_place_typeString
WebAppData 2
dataString
button_textString
ProximityAlertTriggered 3
travelerUser
watcherUser
distanceInteger
MessageAutoDeleteTimerChanged 1
message_auto_delete_timeInteger
ManagedBotCreated 1
botUser
ManagedBotUpdated 2
userUser
botUser
PollOptionAdded 4
poll_messageMaybeInaccessibleMessage
option_persistent_idString
option_textString
option_text_entitiesArray of MessageEntity
PollOptionDeleted 4
poll_messageMaybeInaccessibleMessage
option_persistent_idString
option_textString
option_text_entitiesArray of MessageEntity
ChatBoostAdded 1
boost_countInteger
BackgroundFillSolid 2
typeString
colorInteger
BackgroundFillGradient 4
typeString
top_colorInteger
bottom_colorInteger
rotation_angleInteger
BackgroundFillFreeformGradient 2
typeString
colorsArray of Integer
BackgroundTypeFill 3
typeString
fillBackgroundFill
dark_theme_dimmingInteger
BackgroundTypeWallpaper 5
typeString
documentDocument
dark_theme_dimmingInteger
is_blurredBoolean
is_movingBoolean
BackgroundTypePattern 6
typeString
documentDocument
fillBackgroundFill
intensityInteger
is_invertedBoolean
is_movingBoolean
BackgroundTypeChatTheme 2
typeString
theme_nameString
ChatBackground 1
typeBackgroundType
ForumTopicCreated 4
nameString
icon_colorInteger
icon_custom_emoji_idString
is_name_implicitBoolean
ForumTopicClosed 0
no public fields
ForumTopicEdited 2
nameString
icon_custom_emoji_idString
ForumTopicReopened 0
no public fields
GeneralForumTopicHidden 0
no public fields
GeneralForumTopicUnhidden 0
no public fields
SharedUser 5
user_idInteger
first_nameString
last_nameString
usernameString
photoArray of PhotoSize
UsersShared 2
request_idInteger
usersArray of SharedUser
ChatShared 5
request_idInteger
chat_idInteger
titleString
usernameString
photoArray of PhotoSize
WriteAccessAllowed 3
from_requestBoolean
web_app_nameString
from_attachment_menuBoolean
VideoChatScheduled 1
start_dateInteger
VideoChatStarted 0
no public fields
VideoChatEnded 1
durationInteger
VideoChatParticipantsInvited 1
usersArray of User
PaidMessagePriceChanged 1
paid_message_star_countInteger
DirectMessagePriceChanged 2
are_direct_messages_enabledBoolean
direct_message_star_countInteger
SuggestedPostApproved 3
suggested_post_messageMessage
priceSuggestedPostPrice
send_dateInteger
SuggestedPostApprovalFailed 2
suggested_post_messageMessage
priceSuggestedPostPrice
SuggestedPostDeclined 2
suggested_post_messageMessage
commentString
SuggestedPostPaid 4
suggested_post_messageMessage
currencyString
amountInteger
star_amountStarAmount
SuggestedPostRefunded 2
suggested_post_messageMessage
reasonString
GiveawayCreated 1
prize_star_countInteger
Giveaway 9
chatsArray of Chat
winners_selection_dateInteger
winner_countInteger
only_new_membersBoolean
has_public_winnersBoolean
prize_descriptionString
country_codesArray of String
prize_star_countInteger
premium_subscription_month_countInteger
GiveawayWinners 12
chatChat
giveaway_message_idInteger
winners_selection_dateInteger
winner_countInteger
winnersArray of User
additional_chat_countInteger
prize_star_countInteger
premium_subscription_month_countInteger
unclaimed_prize_countInteger
only_new_membersBoolean
was_refundedBoolean
prize_descriptionString
GiveawayCompleted 4
winner_countInteger
unclaimed_prize_countInteger
giveaway_messageMessage
is_star_giveawayBoolean
LinkPreviewOptions 5
is_disabledBoolean
urlString
prefer_small_mediaBoolean
prefer_large_mediaBoolean
show_above_textBoolean
SuggestedPostPrice 2
currencyString
amountInteger
SuggestedPostInfo 3
stateString
priceSuggestedPostPrice
send_dateInteger
SuggestedPostParameters 2
priceSuggestedPostPrice
send_dateInteger
DirectMessagesTopic 2
topic_idInteger
userUser
UserProfilePhotos 2
total_countInteger
photosArray of Array of PhotoSize
UserProfileAudios 2
total_countInteger
audiosArray of Audio
File 4
file_idString
file_unique_idString
file_sizeInteger
file_pathString
WebAppInfo 1
urlString
ReplyKeyboardMarkup 6
keyboardArray of Array of KeyboardButton
is_persistentBoolean
resize_keyboardBoolean
one_time_keyboardBoolean
input_field_placeholderString
selectiveBoolean
KeyboardButton 10
textString
icon_custom_emoji_idString
styleString
request_usersKeyboardButtonRequestUsers
request_chatKeyboardButtonRequestChat
request_managed_botKeyboardButtonRequestManagedBot
request_contactBoolean
request_locationBoolean
request_pollKeyboardButtonPollType
web_appWebAppInfo
KeyboardButtonRequestUsers 7
request_idInteger
user_is_botBoolean
user_is_premiumBoolean
max_quantityInteger
request_nameBoolean
request_usernameBoolean
request_photoBoolean
KeyboardButtonRequestChat 11
request_idInteger
chat_is_channelBoolean
chat_is_forumBoolean
chat_has_usernameBoolean
chat_is_createdBoolean
user_administrator_rightsChatAdministratorRights
bot_administrator_rightsChatAdministratorRights
bot_is_memberBoolean
request_titleBoolean
request_usernameBoolean
request_photoBoolean
KeyboardButtonRequestManagedBot 3
request_idInteger
suggested_nameString
suggested_usernameString
KeyboardButtonPollType 1
typeString
ReplyKeyboardRemove 2
remove_keyboardBoolean
selectiveBoolean
InlineKeyboardMarkup 1
inline_keyboardArray of Array of InlineKeyboardButton
InlineKeyboardButton 13
textString
icon_custom_emoji_idString
styleString
urlString
callback_dataString
web_appWebAppInfo
login_urlLoginUrl
switch_inline_queryString
switch_inline_query_current_chatString
switch_inline_query_chosen_chatSwitchInlineQueryChosenChat
copy_textCopyTextButton
callback_gameCallbackGame
payBoolean
LoginUrl 4
urlString
forward_textString
bot_usernameString
request_write_accessBoolean
SwitchInlineQueryChosenChat 5
queryString
allow_user_chatsBoolean
allow_bot_chatsBoolean
allow_group_chatsBoolean
allow_channel_chatsBoolean
CopyTextButton 1
textString
CallbackQuery 7
idString
fromUser
messageMaybeInaccessibleMessage
inline_message_idString
chat_instanceString
dataString
game_short_nameString
ForceReply 3
force_replyBoolean
input_field_placeholderString
selectiveBoolean
ChatPhoto 4
small_file_idString
small_file_unique_idString
big_file_idString
big_file_unique_idString
ChatAdministratorRights 17
is_anonymousBoolean
can_manage_chatBoolean
can_delete_messagesBoolean
can_manage_video_chatsBoolean
can_restrict_membersBoolean
can_promote_membersBoolean
can_change_infoBoolean
can_invite_usersBoolean
can_post_storiesBoolean
can_edit_storiesBoolean
can_delete_storiesBoolean
can_post_messagesBoolean
can_edit_messagesBoolean
can_pin_messagesBoolean
can_manage_topicsBoolean
can_manage_direct_messagesBoolean
can_manage_tagsBoolean
ChatMemberUpdated 8
chatChat
fromUser
dateInteger
old_chat_memberChatMember
new_chat_memberChatMember
invite_linkChatInviteLink
via_join_requestBoolean
via_chat_folder_invite_linkBoolean
ChatMemberOwner 4
statusString
userUser
is_anonymousBoolean
custom_titleString
ChatMemberAdministrator 21
statusString
userUser
can_be_editedBoolean
is_anonymousBoolean
can_manage_chatBoolean
can_delete_messagesBoolean
can_manage_video_chatsBoolean
can_restrict_membersBoolean
can_promote_membersBoolean
can_change_infoBoolean
can_invite_usersBoolean
can_post_storiesBoolean
can_edit_storiesBoolean
can_delete_storiesBoolean
can_post_messagesBoolean
can_edit_messagesBoolean
can_pin_messagesBoolean
can_manage_topicsBoolean
can_manage_direct_messagesBoolean
can_manage_tagsBoolean
custom_titleString
ChatMemberMember 4
statusString
tagString
userUser
until_dateInteger
ChatMemberRestricted 20
statusString
tagString
userUser
is_memberBoolean
can_send_messagesBoolean
can_send_audiosBoolean
can_send_documentsBoolean
can_send_photosBoolean
can_send_videosBoolean
can_send_video_notesBoolean
can_send_voice_notesBoolean
can_send_pollsBoolean
can_send_other_messagesBoolean
can_add_web_page_previewsBoolean
can_edit_tagBoolean
can_change_infoBoolean
can_invite_usersBoolean
can_pin_messagesBoolean
can_manage_topicsBoolean
until_dateInteger
ChatMemberLeft 2
statusString
userUser
ChatMemberBanned 3
statusString
userUser
until_dateInteger
ChatJoinRequest 6
chatChat
fromUser
user_chat_idInteger
dateInteger
bioString
invite_linkChatInviteLink
ChatPermissions 15
can_send_messagesBoolean
can_send_audiosBoolean
can_send_documentsBoolean
can_send_photosBoolean
can_send_videosBoolean
can_send_video_notesBoolean
can_send_voice_notesBoolean
can_send_pollsBoolean
can_send_other_messagesBoolean
can_add_web_page_previewsBoolean
can_edit_tagBoolean
can_change_infoBoolean
can_invite_usersBoolean
can_pin_messagesBoolean
can_manage_topicsBoolean
Birthdate 3
dayInteger
monthInteger
yearInteger
BusinessIntro 3
titleString
messageString
stickerSticker
BusinessLocation 2
addressString
locationLocation
BusinessOpeningHoursInterval 2
opening_minuteInteger
closing_minuteInteger
BusinessOpeningHours 2
time_zone_nameString
opening_hoursArray of BusinessOpeningHoursInterval
UserRating 4
levelInteger
ratingInteger
current_level_ratingInteger
next_level_ratingInteger
StoryAreaPosition 6
x_percentageFloat
y_percentageFloat
width_percentageFloat
height_percentageFloat
rotation_angleFloat
corner_radius_percentageFloat
LocationAddress 4
country_codeString
stateString
cityString
streetString
StoryAreaTypeLocation 4
typeString
latitudeFloat
longitudeFloat
addressLocationAddress
StoryAreaTypeSuggestedReaction 4
typeString
reaction_typeReactionType
is_darkBoolean
is_flippedBoolean
StoryAreaTypeWeather 4
typeString
temperatureFloat
emojiString
background_colorInteger
StoryAreaTypeUniqueGift 2
typeString
nameString
StoryArea 2
positionStoryAreaPosition
typeStoryAreaType
ChatLocation 2
locationLocation
addressString
ReactionTypeEmoji 2
typeString
emojiString
ReactionTypeCustomEmoji 2
typeString
custom_emoji_idString
ReactionTypePaid 1
typeString
ReactionCount 2
typeReactionType
total_countInteger
MessageReactionUpdated 7
chatChat
message_idInteger
userUser
actor_chatChat
dateInteger
old_reactionArray of ReactionType
new_reactionArray of ReactionType
MessageReactionCountUpdated 4
chatChat
message_idInteger
dateInteger
reactionsArray of ReactionCount
ForumTopic 5
message_thread_idInteger
nameString
icon_colorInteger
icon_custom_emoji_idString
is_name_implicitBoolean
GiftBackground 3
center_colorInteger
edge_colorInteger
text_colorInteger
Gift 13
idString
stickerSticker
star_countInteger
upgrade_star_countInteger
is_premiumBoolean
has_colorsBoolean
total_countInteger
remaining_countInteger
personal_total_countInteger
personal_remaining_countInteger
backgroundGiftBackground
unique_gift_variant_countInteger
publisher_chatChat
Gifts 1
giftsArray of Gift
UniqueGiftModel 4
nameString
stickerSticker
rarity_per_milleInteger
rarityString
UniqueGiftSymbol 3
nameString
stickerSticker
rarity_per_milleInteger
UniqueGiftBackdropColors 4
center_colorInteger
edge_colorInteger
symbol_colorInteger
text_colorInteger
UniqueGiftBackdrop 3
nameString
colorsUniqueGiftBackdropColors
rarity_per_milleInteger
UniqueGiftColors 6
model_custom_emoji_idString
symbol_custom_emoji_idString
light_theme_main_colorInteger
light_theme_other_colorsArray of Integer
dark_theme_main_colorInteger
dark_theme_other_colorsArray of Integer
UniqueGift 12
gift_idString
base_nameString
nameString
numberInteger
modelUniqueGiftModel
symbolUniqueGiftSymbol
backdropUniqueGiftBackdrop
is_premiumBoolean
is_burnedBoolean
is_from_blockchainBoolean
colorsUniqueGiftColors
publisher_chatChat
GiftInfo 10
giftGift
owned_gift_idString
convert_star_countInteger
prepaid_upgrade_star_countInteger
is_upgrade_separateBoolean
can_be_upgradedBoolean
textString
entitiesArray of MessageEntity
is_privateBoolean
unique_gift_numberInteger
UniqueGiftInfo 7
giftUniqueGift
originString
last_resale_currencyString
last_resale_amountInteger
owned_gift_idString
transfer_star_countInteger
next_transfer_dateInteger
OwnedGiftRegular 15
typeString
giftGift
owned_gift_idString
sender_userUser
send_dateInteger
textString
entitiesArray of MessageEntity
is_privateBoolean
is_savedBoolean
can_be_upgradedBoolean
was_refundedBoolean
convert_star_countInteger
prepaid_upgrade_star_countInteger
is_upgrade_separateBoolean
unique_gift_numberInteger
OwnedGiftUnique 9
typeString
giftUniqueGift
owned_gift_idString
sender_userUser
send_dateInteger
is_savedBoolean
can_be_transferredBoolean
transfer_star_countInteger
next_transfer_dateInteger
OwnedGifts 3
total_countInteger
giftsArray of OwnedGift
next_offsetString
AcceptedGiftTypes 5
unlimited_giftsBoolean
limited_giftsBoolean
unique_giftsBoolean
premium_subscriptionBoolean
gifts_from_channelsBoolean
StarAmount 2
amountInteger
nanostar_amountInteger
BotCommand 2
commandString
descriptionString
BotCommandScopeDefault 1
typeString
BotCommandScopeAllPrivateChats 1
typeString
BotCommandScopeAllGroupChats 1
typeString
BotCommandScopeAllChatAdministrators 1
typeString
BotCommandScopeChat 2
typeString
chat_idInteger | String
BotCommandScopeChatAdministrators 2
typeString
chat_idInteger | String
BotCommandScopeChatMember 3
typeString
chat_idInteger | String
user_idInteger
BotName 1
nameString
BotDescription 1
descriptionString
BotShortDescription 1
short_descriptionString
MenuButtonCommands 1
typeString
MenuButtonWebApp 3
typeString
textString
web_appWebAppInfo
MenuButtonDefault 1
typeString
ChatBoostSourcePremium 2
sourceString
userUser
ChatBoostSourceGiftCode 2
sourceString
userUser
ChatBoostSourceGiveaway 5
sourceString
giveaway_message_idInteger
userUser
prize_star_countInteger
is_unclaimedBoolean
ChatBoost 4
boost_idString
add_dateInteger
expiration_dateInteger
sourceChatBoostSource
ChatBoostUpdated 2
chatChat
boostChatBoost
ChatBoostRemoved 4
chatChat
boost_idString
remove_dateInteger
sourceChatBoostSource
ChatOwnerLeft 1
new_ownerUser
ChatOwnerChanged 1
new_ownerUser
UserChatBoosts 1
boostsArray of ChatBoost
BusinessBotRights 14
can_replyBoolean
can_read_messagesBoolean
can_delete_sent_messagesBoolean
can_delete_all_messagesBoolean
can_edit_nameBoolean
can_edit_bioBoolean
can_edit_profile_photoBoolean
can_edit_usernameBoolean
can_change_gift_settingsBoolean
can_view_gifts_and_starsBoolean
can_convert_gifts_to_starsBoolean
can_transfer_and_upgrade_giftsBoolean
can_transfer_starsBoolean
can_manage_storiesBoolean
BusinessConnection 6
idString
userUser
user_chat_idInteger
dateInteger
rightsBusinessBotRights
is_enabledBoolean
BusinessMessagesDeleted 3
business_connection_idString
chatChat
message_idsArray of Integer
SentWebAppMessage 1
inline_message_idString
PreparedInlineMessage 2
idString
expiration_dateInteger
PreparedKeyboardButton 1
idString
ResponseParameters 2
migrate_to_chat_idInteger
retry_afterInteger
InputMediaPhoto 7
typeString
mediaString
captionString
parse_modeString
caption_entitiesArray of MessageEntity
show_caption_above_mediaBoolean
has_spoilerBoolean
InputMediaVideo 14
typeString
mediaString
thumbnailString
coverString
start_timestampInteger
captionString
parse_modeString
caption_entitiesArray of MessageEntity
show_caption_above_mediaBoolean
widthInteger
heightInteger
durationInteger
supports_streamingBoolean
has_spoilerBoolean
InputMediaAnimation 11
typeString
mediaString
thumbnailString
captionString
parse_modeString
caption_entitiesArray of MessageEntity
show_caption_above_mediaBoolean
widthInteger
heightInteger
durationInteger
has_spoilerBoolean
InputMediaAudio 9
typeString
mediaString
thumbnailString
captionString
parse_modeString
caption_entitiesArray of MessageEntity
durationInteger
performerString
titleString
InputMediaDocument 7
typeString
mediaString
thumbnailString
captionString
parse_modeString
caption_entitiesArray of MessageEntity
disable_content_type_detectionBoolean
InputFile 0
no public fields
InputPaidMediaPhoto 2
typeString
mediaString
InputPaidMediaVideo 9
typeString
mediaString
thumbnailString
coverString
start_timestampInteger
widthInteger
heightInteger
durationInteger
supports_streamingBoolean
InputProfilePhotoStatic 2
typeString
photoString
InputProfilePhotoAnimated 3
typeString
animationString
main_frame_timestampFloat
InputStoryContentPhoto 2
typeString
photoString
InputStoryContentVideo 5
typeString
videoString
durationFloat
cover_frame_timestampFloat
is_animationBoolean
Sticker 15
file_idString
file_unique_idString
typeString
widthInteger
heightInteger
is_animatedBoolean
is_videoBoolean
thumbnailPhotoSize
emojiString
set_nameString
premium_animationFile
mask_positionMaskPosition
custom_emoji_idString
needs_repaintingBoolean
file_sizeInteger
StickerSet 5
nameString
titleString
sticker_typeString
stickersArray of Sticker
thumbnailPhotoSize
MaskPosition 4
pointString
x_shiftFloat
y_shiftFloat
scaleFloat
InputSticker 5
stickerString
formatString
emoji_listArray of String
mask_positionMaskPosition
keywordsArray of String
InlineQuery 6
idString
fromUser
queryString
offsetString
chat_typeString
locationLocation
InlineQueryResultsButton 3
textString
web_appWebAppInfo
start_parameterString
InlineQueryResultArticle 10
typeString
idString
titleString
input_message_contentInputMessageContent
reply_markupInlineKeyboardMarkup
urlString
descriptionString
thumbnail_urlString
thumbnail_widthInteger
thumbnail_heightInteger
InlineQueryResultPhoto 14
typeString
idString
photo_urlString
thumbnail_urlString
photo_widthInteger
photo_heightInteger
titleString
descriptionString
captionString
parse_modeString
caption_entitiesArray of MessageEntity
show_caption_above_mediaBoolean
reply_markupInlineKeyboardMarkup
input_message_contentInputMessageContent
InlineQueryResultGif 15
typeString
idString
gif_urlString
gif_widthInteger
gif_heightInteger
gif_durationInteger
thumbnail_urlString
thumbnail_mime_typeString
titleString
captionString
parse_modeString
caption_entitiesArray of MessageEntity
show_caption_above_mediaBoolean
reply_markupInlineKeyboardMarkup
input_message_contentInputMessageContent
InlineQueryResultMpeg4Gif 15
typeString
idString
mpeg4_urlString
mpeg4_widthInteger
mpeg4_heightInteger
mpeg4_durationInteger
thumbnail_urlString
thumbnail_mime_typeString
titleString
captionString
parse_modeString
caption_entitiesArray of MessageEntity
show_caption_above_mediaBoolean
reply_markupInlineKeyboardMarkup
input_message_contentInputMessageContent
InlineQueryResultVideo 16
typeString
idString
video_urlString
mime_typeString
thumbnail_urlString
titleString
captionString
parse_modeString
caption_entitiesArray of MessageEntity
show_caption_above_mediaBoolean
video_widthInteger
video_heightInteger
video_durationInteger
descriptionString
reply_markupInlineKeyboardMarkup
input_message_contentInputMessageContent
InlineQueryResultAudio 11
typeString
idString
audio_urlString
titleString
captionString
parse_modeString
caption_entitiesArray of MessageEntity
performerString
audio_durationInteger
reply_markupInlineKeyboardMarkup
input_message_contentInputMessageContent
InlineQueryResultVoice 10
typeString
idString
voice_urlString
titleString
captionString
parse_modeString
caption_entitiesArray of MessageEntity
voice_durationInteger
reply_markupInlineKeyboardMarkup
input_message_contentInputMessageContent
InlineQueryResultDocument 14
typeString
idString
titleString
captionString
parse_modeString
caption_entitiesArray of MessageEntity
document_urlString
mime_typeString
descriptionString
reply_markupInlineKeyboardMarkup
input_message_contentInputMessageContent
thumbnail_urlString
thumbnail_widthInteger
thumbnail_heightInteger
InlineQueryResultLocation 14
typeString
idString
latitudeFloat
longitudeFloat
titleString
horizontal_accuracyFloat
live_periodInteger
headingInteger
proximity_alert_radiusInteger
reply_markupInlineKeyboardMarkup
input_message_contentInputMessageContent
thumbnail_urlString
thumbnail_widthInteger
thumbnail_heightInteger
InlineQueryResultVenue 15
typeString
idString
latitudeFloat
longitudeFloat
titleString
addressString
foursquare_idString
foursquare_typeString
google_place_idString
google_place_typeString
reply_markupInlineKeyboardMarkup
input_message_contentInputMessageContent
thumbnail_urlString
thumbnail_widthInteger
thumbnail_heightInteger
InlineQueryResultContact 11
typeString
idString
phone_numberString
first_nameString
last_nameString
vcardString
reply_markupInlineKeyboardMarkup
input_message_contentInputMessageContent
thumbnail_urlString
thumbnail_widthInteger
thumbnail_heightInteger
InlineQueryResultGame 4
typeString
idString
game_short_nameString
reply_markupInlineKeyboardMarkup
InlineQueryResultCachedPhoto 11
typeString
idString
photo_file_idString
titleString
descriptionString
captionString
parse_modeString
caption_entitiesArray of MessageEntity
show_caption_above_mediaBoolean
reply_markupInlineKeyboardMarkup
input_message_contentInputMessageContent
InlineQueryResultCachedGif 10
typeString
idString
gif_file_idString
titleString
captionString
parse_modeString
caption_entitiesArray of MessageEntity
show_caption_above_mediaBoolean
reply_markupInlineKeyboardMarkup
input_message_contentInputMessageContent
InlineQueryResultCachedMpeg4Gif 10
typeString
idString
mpeg4_file_idString
titleString
captionString
parse_modeString
caption_entitiesArray of MessageEntity
show_caption_above_mediaBoolean
reply_markupInlineKeyboardMarkup
input_message_contentInputMessageContent
InlineQueryResultCachedSticker 5
typeString
idString
sticker_file_idString
reply_markupInlineKeyboardMarkup
input_message_contentInputMessageContent
InlineQueryResultCachedDocument 10
typeString
idString
titleString
document_file_idString
descriptionString
captionString
parse_modeString
caption_entitiesArray of MessageEntity
reply_markupInlineKeyboardMarkup
input_message_contentInputMessageContent
InlineQueryResultCachedVideo 11
typeString
idString
video_file_idString
titleString
descriptionString
captionString
parse_modeString
caption_entitiesArray of MessageEntity
show_caption_above_mediaBoolean
reply_markupInlineKeyboardMarkup
input_message_contentInputMessageContent
InlineQueryResultCachedVoice 9
typeString
idString
voice_file_idString
titleString
captionString
parse_modeString
caption_entitiesArray of MessageEntity
reply_markupInlineKeyboardMarkup
input_message_contentInputMessageContent
InlineQueryResultCachedAudio 8
typeString
idString
audio_file_idString
captionString
parse_modeString
caption_entitiesArray of MessageEntity
reply_markupInlineKeyboardMarkup
input_message_contentInputMessageContent
InputTextMessageContent 4
message_textString
parse_modeString
entitiesArray of MessageEntity
link_preview_optionsLinkPreviewOptions
InputLocationMessageContent 6
latitudeFloat
longitudeFloat
horizontal_accuracyFloat
live_periodInteger
headingInteger
proximity_alert_radiusInteger
InputVenueMessageContent 8
latitudeFloat
longitudeFloat
titleString
addressString
foursquare_idString
foursquare_typeString
google_place_idString
google_place_typeString
InputContactMessageContent 4
phone_numberString
first_nameString
last_nameString
vcardString
InputInvoiceMessageContent 20
titleString
descriptionString
payloadString
provider_tokenString
currencyString
pricesArray of LabeledPrice
max_tip_amountInteger
suggested_tip_amountsArray of Integer
provider_dataString
photo_urlString
photo_sizeInteger
photo_widthInteger
photo_heightInteger
need_nameBoolean
need_phone_numberBoolean
need_emailBoolean
need_shipping_addressBoolean
send_phone_number_to_providerBoolean
send_email_to_providerBoolean
is_flexibleBoolean
ChosenInlineResult 5
result_idString
fromUser
locationLocation
inline_message_idString
queryString
LabeledPrice 2
labelString
amountInteger
Invoice 5
titleString
descriptionString
start_parameterString
currencyString
total_amountInteger
ShippingAddress 6
country_codeString
stateString
cityString
street_line1String
street_line2String
post_codeString
OrderInfo 4
nameString
phone_numberString
emailString
shipping_addressShippingAddress
ShippingOption 3
idString
titleString
pricesArray of LabeledPrice
SuccessfulPayment 10
currencyString
total_amountInteger
invoice_payloadString
subscription_expiration_dateInteger
is_recurringBoolean
is_first_recurringBoolean
shipping_option_idString
order_infoOrderInfo
telegram_payment_charge_idString
provider_payment_charge_idString
RefundedPayment 5
currencyString
total_amountInteger
invoice_payloadString
telegram_payment_charge_idString
provider_payment_charge_idString
ShippingQuery 4
idString
fromUser
invoice_payloadString
shipping_addressShippingAddress
PreCheckoutQuery 7
idString
fromUser
currencyString
total_amountInteger
invoice_payloadString
shipping_option_idString
order_infoOrderInfo
PaidMediaPurchased 2
fromUser
paid_media_payloadString
RevenueWithdrawalStatePending 1
typeString
RevenueWithdrawalStateSucceeded 3
typeString
dateInteger
urlString
RevenueWithdrawalStateFailed 1
typeString
AffiliateInfo 5
affiliate_userUser
affiliate_chatChat
commission_per_milleInteger
amountInteger
nanostar_amountInteger
TransactionPartnerUser 10
typeString
transaction_typeString
userUser
affiliateAffiliateInfo
invoice_payloadString
subscription_periodInteger
paid_mediaArray of PaidMedia
paid_media_payloadString
giftGift
premium_subscription_durationInteger
TransactionPartnerChat 3
typeString
chatChat
giftGift
TransactionPartnerAffiliateProgram 3
typeString
sponsor_userUser
commission_per_milleInteger
TransactionPartnerFragment 2
typeString
withdrawal_stateRevenueWithdrawalState
TransactionPartnerTelegramAds 1
typeString
TransactionPartnerTelegramApi 2
typeString
request_countInteger
TransactionPartnerOther 1
typeString
StarTransaction 6
idString
amountInteger
nanostar_amountInteger
dateInteger
sourceTransactionPartner
receiverTransactionPartner
StarTransactions 1
transactionsArray of StarTransaction
PassportData 2
dataArray of EncryptedPassportElement
credentialsEncryptedCredentials
PassportFile 4
file_idString
file_unique_idString
file_sizeInteger
file_dateInteger
EncryptedPassportElement 10
typeString
dataString
phone_numberString
emailString
filesArray of PassportFile
front_sidePassportFile
reverse_sidePassportFile
selfiePassportFile
translationArray of PassportFile
hashString
EncryptedCredentials 3
dataString
hashString
secretString
PassportElementErrorDataField 5
sourceString
typeString
field_nameString
data_hashString
messageString
PassportElementErrorFrontSide 4
sourceString
typeString
file_hashString
messageString
PassportElementErrorReverseSide 4
sourceString
typeString
file_hashString
messageString
PassportElementErrorSelfie 4
sourceString
typeString
file_hashString
messageString
PassportElementErrorFile 4
sourceString
typeString
file_hashString
messageString
PassportElementErrorFiles 4
sourceString
typeString
file_hashesArray of String
messageString
PassportElementErrorTranslationFile 4
sourceString
typeString
file_hashString
messageString
PassportElementErrorTranslationFiles 4
sourceString
typeString
file_hashesArray of String
messageString
PassportElementErrorUnspecified 4
sourceString
typeString
element_hashString
messageString
Game 6
titleString
descriptionString
photoArray of PhotoSize
textString
text_entitiesArray of MessageEntity
animationAnimation
CallbackGame 0
no public fields
GameHighScore 3
positionInteger
userUser
scoreInteger
MaybeInaccessibleMessage
Message InaccessibleMessage
MessageOrigin
MessageOriginUser MessageOriginHiddenUser MessageOriginChat MessageOriginChannel
PaidMedia
PaidMediaPreview PaidMediaPhoto PaidMediaVideo
BackgroundFill
BackgroundFillSolid BackgroundFillGradient BackgroundFillFreeformGradient
BackgroundType
BackgroundTypeFill BackgroundTypeWallpaper BackgroundTypePattern BackgroundTypeChatTheme
ChatMember
ChatMemberOwner ChatMemberAdministrator ChatMemberMember ChatMemberRestricted ChatMemberLeft ChatMemberBanned
StoryAreaType
StoryAreaTypeLocation StoryAreaTypeSuggestedReaction StoryAreaTypeLink StoryAreaTypeWeather StoryAreaTypeUniqueGift
ReactionType
ReactionTypeEmoji ReactionTypeCustomEmoji ReactionTypePaid
OwnedGift
OwnedGiftRegular OwnedGiftUnique
BotCommandScope
BotCommandScopeDefault BotCommandScopeAllPrivateChats BotCommandScopeAllGroupChats BotCommandScopeAllChatAdministrators BotCommandScopeChat BotCommandScopeChatAdministrators BotCommandScopeChatMember
MenuButton
MenuButtonCommands MenuButtonWebApp MenuButtonDefault
ChatBoostSource
ChatBoostSourcePremium ChatBoostSourceGiftCode ChatBoostSourceGiveaway
InputMedia
InputMediaAnimation InputMediaDocument InputMediaAudio InputMediaPhoto InputMediaVideo
InputPaidMedia
InputPaidMediaPhoto InputPaidMediaVideo
InputProfilePhoto
InputProfilePhotoStatic InputProfilePhotoAnimated
InputStoryContent
InputStoryContentPhoto InputStoryContentVideo
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
RevenueWithdrawalState
RevenueWithdrawalStatePending RevenueWithdrawalStateSucceeded RevenueWithdrawalStateFailed
TransactionPartner
TransactionPartnerUser TransactionPartnerChat TransactionPartnerAffiliateProgram TransactionPartnerFragment TransactionPartnerTelegramAds TransactionPartnerTelegramApi TransactionPartnerOther
PassportElementError
PassportElementErrorDataField PassportElementErrorFrontSide PassportElementErrorReverseSide PassportElementErrorSelfie PassportElementErrorFile PassportElementErrorFiles PassportElementErrorTranslationFile PassportElementErrorTranslationFiles PassportElementErrorUnspecified
ChatId

Accepts numeric IDs, @usernames, or raw strings.

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

Flexible file input: disk path, URL, or in-memory bytes.

use ferobot::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")?);