pub struct BotClient { /* private fields */ }Expand description
The Telegram Bot API HTTP client.
BotClient is cheap to clone — all internal state is reference-counted.
It is safe to share across tasks and threads without additional
synchronisation.
§Creating a client
// From a token string (simplest)
let client = BotClient::from_token("123456:ABC...")?;
// From a ClientConfig for advanced options
let config = ClientConfig::new("123456:ABC...")?
.api_base_url("http://localhost:8081")
.timeout(Duration::from_secs(60));
let client = BotClient::new(config)?;§Making API calls
Every Bot API method is available as a method on BotClient. Each method
returns a builder — set optional parameters with chained calls, then
.await to execute:
client
.send_message(chat_id, "Hello!")
.parse_mode(ParseMode::HTML)
.disable_notification(true)
.await?;Implementations§
Source§impl BotClient
impl BotClient
Sourcepub fn new(config: ClientConfig) -> Result<Self>
pub fn new(config: ClientConfig) -> Result<Self>
Creates a new BotClient from a ClientConfig.
§Errors
Returns an error if the underlying HTTP client cannot be initialised.
Sourcepub fn from_token(token: impl Into<String>) -> Result<Self>
pub fn from_token(token: impl Into<String>) -> Result<Self>
Creates a BotClient directly from a bot token string.
This is equivalent to BotClient::new(ClientConfig::new(token)?).
§Errors
Returns Error::InvalidToken if the token format is invalid.
Sourcepub fn api_base_url(&self) -> &str
pub fn api_base_url(&self) -> &str
Returns the base URL used for API requests, defaulting to https://api.telegram.org.
Sourcepub async fn post_json<P, R>(&self, method: &str, params: &P) -> Result<R>
pub async fn post_json<P, R>(&self, method: &str, params: &P) -> Result<R>
Sends a JSON POST request to a Bot API method and deserialises the result.
Automatically retries on HTTP 429 (flood control) up to max_retries
times, waiting the retry_after duration between attempts.
Byte uploads take post_multipart instead,
which does not retry.
§Errors
Returns an error on network failure, API error (ok: false), or
deserialisation failure.
Sourcepub async fn post_multipart<R>(&self, method: &str, form: Form) -> Result<R>where
R: DeserializeOwned,
pub async fn post_multipart<R>(&self, method: &str, form: Form) -> Result<R>where
R: DeserializeOwned,
Sends a multipart/form-data POST request to a Bot API method and deserialises the result.
Unlike post_json this does not retry on
flood control, regardless of
ClientConfig::max_retries: the form
is consumed by the send and cannot be rebuilt for another attempt. A 429
surfaces immediately as Error::RateLimit.
Sourcepub async fn download_file(&self, file_path: &str) -> Result<Bytes>
pub async fn download_file(&self, file_path: &str) -> Result<Bytes>
Downloads a file by its path as returned by BotClient::get_file.
The file path must be obtained by calling get_file first:
let file = client.get_file(&document.file_id).await?;
let bytes = client.download_file(&file.file_path.unwrap()).await?;Maximum file size via the Telegram cloud server is 20 MB. Use a local Bot API server to lift this restriction.
Sourcepub fn get_updates(&self) -> GetUpdates
pub fn get_updates(&self) -> GetUpdates
Calls getUpdates — fetches a batch of incoming updates via long polling.
Sourcepub fn set_webhook(&self, url: impl Into<String>) -> SetWebhook
pub fn set_webhook(&self, url: impl Into<String>) -> SetWebhook
Calls setWebhook — registers a webhook URL with Telegram.
Sourcepub fn delete_webhook(&self) -> DeleteWebhook
pub fn delete_webhook(&self) -> DeleteWebhook
Calls deleteWebhook — removes the webhook integration.
Sourcepub fn get_webhook_info(&self) -> GetWebhookInfo
pub fn get_webhook_info(&self) -> GetWebhookInfo
Calls getWebhookInfo — returns the current webhook status.
Sourcepub fn get_chat(&self, chat_id: impl Into<ChatId>) -> GetChat
pub fn get_chat(&self, chat_id: impl Into<ChatId>) -> GetChat
Calls getChat — returns detailed information about a chat.
Sourcepub fn get_chat_administrators(
&self,
chat_id: impl Into<ChatId>,
) -> GetChatAdministrators
pub fn get_chat_administrators( &self, chat_id: impl Into<ChatId>, ) -> GetChatAdministrators
Calls getChatAdministrators — returns a list of all chat administrators.
Sourcepub fn get_chat_member_count(
&self,
chat_id: impl Into<ChatId>,
) -> GetChatMemberCount
pub fn get_chat_member_count( &self, chat_id: impl Into<ChatId>, ) -> GetChatMemberCount
Calls getChatMemberCount — returns the number of members in a chat.
Sourcepub fn get_chat_member(
&self,
chat_id: impl Into<ChatId>,
user_id: i64,
) -> GetChatMember
pub fn get_chat_member( &self, chat_id: impl Into<ChatId>, user_id: i64, ) -> GetChatMember
Calls getChatMember — returns information about a specific chat member.
Sourcepub fn get_file(&self, file_id: impl Into<String>) -> GetFile
pub fn get_file(&self, file_id: impl Into<String>) -> GetFile
Calls getFile — returns file metadata and a download path.
Sourcepub fn get_user_profile_photos(&self, user_id: i64) -> GetUserProfilePhotos
pub fn get_user_profile_photos(&self, user_id: i64) -> GetUserProfilePhotos
Calls getUserProfilePhotos — returns a user’s profile pictures.
Sourcepub fn get_user_profile_audios(&self, user_id: i64) -> GetUserProfileAudios
pub fn get_user_profile_audios(&self, user_id: i64) -> GetUserProfileAudios
Calls getUserProfileAudios — returns audios displayed on a user’s profile (Bot API 9.4).
Sourcepub fn get_user_personal_chat_messages(
&self,
user_id: i64,
limit: u32,
) -> GetUserPersonalChatMessages
pub fn get_user_personal_chat_messages( &self, user_id: i64, limit: u32, ) -> GetUserPersonalChatMessages
Calls getUserPersonalChatMessages — returns the last messages from a user’s personal chat (Bot API 9.7).
limit must be between 1 and 20.
Sourcepub fn send_message(
&self,
chat_id: impl Into<ChatId>,
text: impl Into<String>,
) -> SendMessage
pub fn send_message( &self, chat_id: impl Into<ChatId>, text: impl Into<String>, ) -> SendMessage
Calls sendMessage — sends a text message to a chat.
Sourcepub fn forward_message(
&self,
chat_id: impl Into<ChatId>,
from_chat_id: impl Into<ChatId>,
message_id: i64,
) -> ForwardMessage
pub fn forward_message( &self, chat_id: impl Into<ChatId>, from_chat_id: impl Into<ChatId>, message_id: i64, ) -> ForwardMessage
Calls forwardMessage — forwards a message from one chat to another.
Sourcepub fn copy_message(
&self,
chat_id: impl Into<ChatId>,
from_chat_id: impl Into<ChatId>,
message_id: i64,
) -> CopyMessage
pub fn copy_message( &self, chat_id: impl Into<ChatId>, from_chat_id: impl Into<ChatId>, message_id: i64, ) -> CopyMessage
Calls copyMessage — copies a message without the forward header.
Sourcepub fn send_chat_action(
&self,
chat_id: impl Into<ChatId>,
action: ChatAction,
) -> SendChatAction
pub fn send_chat_action( &self, chat_id: impl Into<ChatId>, action: ChatAction, ) -> SendChatAction
Calls sendChatAction — displays a typing or upload indicator.
Sourcepub fn send_photo(
&self,
chat_id: impl Into<ChatId>,
photo: InputFile,
) -> SendPhoto
pub fn send_photo( &self, chat_id: impl Into<ChatId>, photo: InputFile, ) -> SendPhoto
Calls sendPhoto — sends a photo.
Sourcepub fn send_live_photo(
&self,
chat_id: impl Into<ChatId>,
live_photo: InputFile,
photo: InputFile,
) -> SendLivePhoto
pub fn send_live_photo( &self, chat_id: impl Into<ChatId>, live_photo: InputFile, photo: InputFile, ) -> SendLivePhoto
Calls sendLivePhoto — sends a live photo (Bot API 9.7).
live_photo is the video component; photo is the static preview.
Sending by URL is currently unsupported — use InputFile::FileId or InputFile::Bytes.
Sourcepub fn send_audio(
&self,
chat_id: impl Into<ChatId>,
audio: InputFile,
) -> SendAudio
pub fn send_audio( &self, chat_id: impl Into<ChatId>, audio: InputFile, ) -> SendAudio
Calls sendAudio — sends an audio file treated as music.
Sourcepub fn send_document(
&self,
chat_id: impl Into<ChatId>,
document: InputFile,
) -> SendDocument
pub fn send_document( &self, chat_id: impl Into<ChatId>, document: InputFile, ) -> SendDocument
Calls sendDocument — sends a general file.
Sourcepub fn send_video(
&self,
chat_id: impl Into<ChatId>,
video: InputFile,
) -> SendVideo
pub fn send_video( &self, chat_id: impl Into<ChatId>, video: InputFile, ) -> SendVideo
Calls sendVideo — sends a video file.
Sourcepub fn send_animation(
&self,
chat_id: impl Into<ChatId>,
animation: InputFile,
) -> SendAnimation
pub fn send_animation( &self, chat_id: impl Into<ChatId>, animation: InputFile, ) -> SendAnimation
Calls sendAnimation — sends a GIF or silent H.264 video.
Sourcepub fn send_voice(
&self,
chat_id: impl Into<ChatId>,
voice: InputFile,
) -> SendVoice
pub fn send_voice( &self, chat_id: impl Into<ChatId>, voice: InputFile, ) -> SendVoice
Calls sendVoice — sends a voice note.
Sourcepub fn send_video_note(
&self,
chat_id: impl Into<ChatId>,
video_note: InputFile,
) -> SendVideoNote
pub fn send_video_note( &self, chat_id: impl Into<ChatId>, video_note: InputFile, ) -> SendVideoNote
Calls sendVideoNote — sends a rounded-square video.
Sourcepub fn send_sticker(
&self,
chat_id: impl Into<ChatId>,
sticker: InputFile,
) -> SendSticker
pub fn send_sticker( &self, chat_id: impl Into<ChatId>, sticker: InputFile, ) -> SendSticker
Calls sendSticker — sends a sticker.
Sourcepub fn send_location(
&self,
chat_id: impl Into<ChatId>,
latitude: f64,
longitude: f64,
) -> SendLocation
pub fn send_location( &self, chat_id: impl Into<ChatId>, latitude: f64, longitude: f64, ) -> SendLocation
Calls sendLocation — sends a geographic location, optionally live.
Sourcepub fn send_contact(
&self,
chat_id: impl Into<ChatId>,
phone_number: impl Into<String>,
first_name: impl Into<String>,
) -> SendContact
pub fn send_contact( &self, chat_id: impl Into<ChatId>, phone_number: impl Into<String>, first_name: impl Into<String>, ) -> SendContact
Calls sendContact — sends a phone contact.
Sourcepub fn send_poll(
&self,
chat_id: impl Into<ChatId>,
question: impl Into<String>,
options: Vec<InputPollOption>,
) -> SendPoll
pub fn send_poll( &self, chat_id: impl Into<ChatId>, question: impl Into<String>, options: Vec<InputPollOption>, ) -> SendPoll
Calls sendPoll — sends a native poll or quiz.
Sourcepub fn send_dice(&self, chat_id: impl Into<ChatId>) -> SendDice
pub fn send_dice(&self, chat_id: impl Into<ChatId>) -> SendDice
Calls sendDice — sends an animated random emoji.
Sourcepub fn send_venue(
&self,
chat_id: impl Into<ChatId>,
latitude: f64,
longitude: f64,
title: impl Into<String>,
address: impl Into<String>,
) -> SendVenue
pub fn send_venue( &self, chat_id: impl Into<ChatId>, latitude: f64, longitude: f64, title: impl Into<String>, address: impl Into<String>, ) -> SendVenue
Calls sendVenue — sends information about a venue.
Sourcepub fn forward_messages(
&self,
chat_id: impl Into<ChatId>,
from_chat_id: impl Into<ChatId>,
message_ids: Vec<i64>,
) -> ForwardMessages
pub fn forward_messages( &self, chat_id: impl Into<ChatId>, from_chat_id: impl Into<ChatId>, message_ids: Vec<i64>, ) -> ForwardMessages
Calls forwardMessages — forwards 1–100 messages at once, preserving album grouping.
Sourcepub fn copy_messages(
&self,
chat_id: impl Into<ChatId>,
from_chat_id: impl Into<ChatId>,
message_ids: Vec<i64>,
) -> CopyMessages
pub fn copy_messages( &self, chat_id: impl Into<ChatId>, from_chat_id: impl Into<ChatId>, message_ids: Vec<i64>, ) -> CopyMessages
Calls copyMessages — copies 1–100 messages without a forward link, preserving album grouping.
Sourcepub fn send_media_group(
&self,
chat_id: impl Into<ChatId>,
media: Vec<InputMedia>,
) -> SendMediaGroup
pub fn send_media_group( &self, chat_id: impl Into<ChatId>, media: Vec<InputMedia>, ) -> SendMediaGroup
Calls sendMediaGroup — sends 2–10 photos, videos, documents, or audios as an album.
Sourcepub fn send_paid_media(
&self,
chat_id: impl Into<ChatId>,
star_count: u32,
media: Vec<InputPaidMedia>,
) -> SendPaidMedia
pub fn send_paid_media( &self, chat_id: impl Into<ChatId>, star_count: u32, media: Vec<InputPaidMedia>, ) -> SendPaidMedia
Calls sendPaidMedia — sends paid media requiring Telegram Stars to view.
Sourcepub fn send_game(
&self,
chat_id: i64,
game_short_name: impl Into<String>,
) -> SendGame
pub fn send_game( &self, chat_id: i64, game_short_name: impl Into<String>, ) -> SendGame
Calls sendGame — sends an HTML5 game.
Sourcepub fn send_checklist(
&self,
business_connection_id: impl Into<String>,
chat_id: i64,
checklist: InputChecklist,
) -> SendChecklist
pub fn send_checklist( &self, business_connection_id: impl Into<String>, chat_id: i64, checklist: InputChecklist, ) -> SendChecklist
Calls sendChecklist — sends a checklist on behalf of a business account.
Sourcepub fn send_message_draft(
&self,
chat_id: impl Into<ChatId>,
draft_id: i64,
text: impl Into<String>,
) -> SendMessageDraft
pub fn send_message_draft( &self, chat_id: impl Into<ChatId>, draft_id: i64, text: impl Into<String>, ) -> SendMessageDraft
Calls sendMessageDraft — streams a partial message (Bot API 9.5+).
Sourcepub fn send_rich_message(
&self,
chat_id: impl Into<ChatId>,
rich_message: InputRichMessage,
) -> SendRichMessage
pub fn send_rich_message( &self, chat_id: impl Into<ChatId>, rich_message: InputRichMessage, ) -> SendRichMessage
Calls sendRichMessage — sends a rich formatted message (Bot API 10.1).
Sourcepub fn send_rich_message_draft(
&self,
chat_id: i64,
draft_id: i64,
rich_message: InputRichMessage,
) -> SendRichMessageDraft
pub fn send_rich_message_draft( &self, chat_id: i64, draft_id: i64, rich_message: InputRichMessage, ) -> SendRichMessageDraft
Calls sendRichMessageDraft — streams a partial rich message as an ephemeral preview (Bot API 10.1).
The draft expires after 30 seconds. Call send_rich_message
with the completed content to persist it.
Sourcepub fn delete_message(
&self,
chat_id: impl Into<ChatId>,
message_id: i64,
) -> DeleteMessage
pub fn delete_message( &self, chat_id: impl Into<ChatId>, message_id: i64, ) -> DeleteMessage
Calls deleteMessage — deletes a message.
Sourcepub fn delete_messages(
&self,
chat_id: impl Into<ChatId>,
message_ids: Vec<i64>,
) -> DeleteMessages
pub fn delete_messages( &self, chat_id: impl Into<ChatId>, message_ids: Vec<i64>, ) -> DeleteMessages
Calls deleteMessages — deletes up to 100 messages at once.
Sourcepub fn delete_ephemeral_message(
&self,
chat_id: impl Into<ChatId>,
receiver_user_id: i64,
ephemeral_message_id: i64,
) -> DeleteEphemeralMessage
pub fn delete_ephemeral_message( &self, chat_id: impl Into<ChatId>, receiver_user_id: i64, ephemeral_message_id: i64, ) -> DeleteEphemeralMessage
Calls deleteEphemeralMessage — deletes an ephemeral message (Bot API 10.2).
Sourcepub fn stop_poll(&self, chat_id: impl Into<ChatId>, message_id: i64) -> StopPoll
pub fn stop_poll(&self, chat_id: impl Into<ChatId>, message_id: i64) -> StopPoll
Calls stopPoll — stops an open poll.
Sourcepub fn answer_callback_query(
&self,
callback_query_id: impl Into<String>,
) -> AnswerCallbackQuery
pub fn answer_callback_query( &self, callback_query_id: impl Into<String>, ) -> AnswerCallbackQuery
Calls answerCallbackQuery — acknowledges a callback button press.
Sourcepub fn edit_message_text(
&self,
chat_id: impl Into<ChatId>,
message_id: i64,
text: impl Into<String>,
) -> EditMessageText
pub fn edit_message_text( &self, chat_id: impl Into<ChatId>, message_id: i64, text: impl Into<String>, ) -> EditMessageText
Calls editMessageText — edits the text of a sent message.
Sourcepub fn edit_inline_message_text(
&self,
inline_message_id: impl Into<String>,
text: impl Into<String>,
) -> EditMessageText
pub fn edit_inline_message_text( &self, inline_message_id: impl Into<String>, text: impl Into<String>, ) -> EditMessageText
Calls editMessageText for an inline message sent via inline mode.
Sourcepub fn edit_message_rich_text(
&self,
chat_id: impl Into<ChatId>,
message_id: i64,
rich_message: InputRichMessage,
) -> EditMessageText
pub fn edit_message_rich_text( &self, chat_id: impl Into<ChatId>, message_id: i64, rich_message: InputRichMessage, ) -> EditMessageText
Calls editMessageText to replace a chat message with rich formatted content.
Sourcepub fn edit_inline_message_rich_text(
&self,
inline_message_id: impl Into<String>,
rich_message: InputRichMessage,
) -> EditMessageText
pub fn edit_inline_message_rich_text( &self, inline_message_id: impl Into<String>, rich_message: InputRichMessage, ) -> EditMessageText
Calls editMessageText to replace an inline message with rich formatted content.
Sourcepub fn edit_message_caption(
&self,
chat_id: impl Into<ChatId>,
message_id: i64,
) -> EditMessageCaption
pub fn edit_message_caption( &self, chat_id: impl Into<ChatId>, message_id: i64, ) -> EditMessageCaption
Calls editMessageCaption — edits the caption of a media message.
Sourcepub fn edit_inline_message_caption(
&self,
inline_message_id: impl Into<String>,
) -> EditMessageCaption
pub fn edit_inline_message_caption( &self, inline_message_id: impl Into<String>, ) -> EditMessageCaption
Calls editMessageCaption for an inline message sent via inline mode.
Sourcepub fn edit_message_media(
&self,
chat_id: impl Into<ChatId>,
message_id: i64,
media: InputMedia,
) -> EditMessageMedia
pub fn edit_message_media( &self, chat_id: impl Into<ChatId>, message_id: i64, media: InputMedia, ) -> EditMessageMedia
Calls editMessageMedia — replaces the media content of a message.
Sourcepub fn edit_inline_message_media(
&self,
inline_message_id: impl Into<String>,
media: InputMedia,
) -> EditMessageMedia
pub fn edit_inline_message_media( &self, inline_message_id: impl Into<String>, media: InputMedia, ) -> EditMessageMedia
Calls editMessageMedia for an inline message sent via inline mode.
Sourcepub fn edit_message_reply_markup(
&self,
chat_id: impl Into<ChatId>,
message_id: i64,
) -> EditMessageReplyMarkup
pub fn edit_message_reply_markup( &self, chat_id: impl Into<ChatId>, message_id: i64, ) -> EditMessageReplyMarkup
Calls editMessageReplyMarkup — replaces the inline keyboard of a message.
Sourcepub fn edit_inline_message_reply_markup(
&self,
inline_message_id: impl Into<String>,
) -> EditMessageReplyMarkup
pub fn edit_inline_message_reply_markup( &self, inline_message_id: impl Into<String>, ) -> EditMessageReplyMarkup
Calls editMessageReplyMarkup for an inline message sent via inline mode.
Sourcepub fn edit_ephemeral_message_text(
&self,
chat_id: impl Into<ChatId>,
receiver_user_id: i64,
ephemeral_message_id: i64,
text: impl Into<String>,
) -> EditEphemeralMessageText
pub fn edit_ephemeral_message_text( &self, chat_id: impl Into<ChatId>, receiver_user_id: i64, ephemeral_message_id: i64, text: impl Into<String>, ) -> EditEphemeralMessageText
Calls editEphemeralMessageText — edits the text of an ephemeral message (Bot API 10.2).
Sourcepub fn edit_ephemeral_message_caption(
&self,
chat_id: impl Into<ChatId>,
receiver_user_id: i64,
ephemeral_message_id: i64,
) -> EditEphemeralMessageCaption
pub fn edit_ephemeral_message_caption( &self, chat_id: impl Into<ChatId>, receiver_user_id: i64, ephemeral_message_id: i64, ) -> EditEphemeralMessageCaption
Calls editEphemeralMessageCaption — edits the caption of an ephemeral message (Bot API 10.2).
Sourcepub fn edit_ephemeral_message_media(
&self,
chat_id: impl Into<ChatId>,
receiver_user_id: i64,
ephemeral_message_id: i64,
media: InputMedia,
) -> EditEphemeralMessageMedia
pub fn edit_ephemeral_message_media( &self, chat_id: impl Into<ChatId>, receiver_user_id: i64, ephemeral_message_id: i64, media: InputMedia, ) -> EditEphemeralMessageMedia
Calls editEphemeralMessageMedia — replaces the media of an ephemeral message.
Delivery of the edit is not guaranteed, particularly if the receiving user is offline.
Sourcepub fn edit_ephemeral_message_reply_markup(
&self,
chat_id: impl Into<ChatId>,
receiver_user_id: i64,
ephemeral_message_id: i64,
) -> EditEphemeralMessageReplyMarkup
pub fn edit_ephemeral_message_reply_markup( &self, chat_id: impl Into<ChatId>, receiver_user_id: i64, ephemeral_message_id: i64, ) -> EditEphemeralMessageReplyMarkup
Calls editEphemeralMessageReplyMarkup — replaces the inline keyboard of an
ephemeral message (Bot API 10.2).
Sourcepub fn edit_message_checklist(
&self,
business_connection_id: impl Into<String>,
chat_id: i64,
message_id: i64,
checklist: InputChecklist,
) -> EditMessageChecklist
pub fn edit_message_checklist( &self, business_connection_id: impl Into<String>, chat_id: i64, message_id: i64, checklist: InputChecklist, ) -> EditMessageChecklist
Calls editMessageChecklist — edits a checklist on behalf of a business account.
Sourcepub fn approve_suggested_post(
&self,
chat_id: i64,
message_id: i64,
) -> ApproveSuggestedPost
pub fn approve_suggested_post( &self, chat_id: i64, message_id: i64, ) -> ApproveSuggestedPost
Calls approveSuggestedPost — approves a suggested post in a direct messages chat.
Sourcepub fn decline_suggested_post(
&self,
chat_id: i64,
message_id: i64,
) -> DeclineSuggestedPost
pub fn decline_suggested_post( &self, chat_id: i64, message_id: i64, ) -> DeclineSuggestedPost
Calls declineSuggestedPost — declines a suggested post in a direct messages chat.
Sourcepub fn edit_message_live_location(
&self,
chat_id: impl Into<ChatId>,
message_id: i64,
latitude: f64,
longitude: f64,
) -> EditMessageLiveLocation
pub fn edit_message_live_location( &self, chat_id: impl Into<ChatId>, message_id: i64, latitude: f64, longitude: f64, ) -> EditMessageLiveLocation
Calls editMessageLiveLocation — updates the position of a live location.
Sourcepub fn edit_inline_message_live_location(
&self,
inline_message_id: impl Into<String>,
latitude: f64,
longitude: f64,
) -> EditMessageLiveLocation
pub fn edit_inline_message_live_location( &self, inline_message_id: impl Into<String>, latitude: f64, longitude: f64, ) -> EditMessageLiveLocation
Calls editMessageLiveLocation for an inline message sent via inline mode.
Sourcepub fn stop_message_live_location(
&self,
chat_id: impl Into<ChatId>,
message_id: i64,
) -> StopMessageLiveLocation
pub fn stop_message_live_location( &self, chat_id: impl Into<ChatId>, message_id: i64, ) -> StopMessageLiveLocation
Calls stopMessageLiveLocation — stops a live location from updating.
Sourcepub fn stop_inline_message_live_location(
&self,
inline_message_id: impl Into<String>,
) -> StopMessageLiveLocation
pub fn stop_inline_message_live_location( &self, inline_message_id: impl Into<String>, ) -> StopMessageLiveLocation
Calls stopMessageLiveLocation for an inline message sent via inline mode.
Sourcepub fn ban_chat_member(
&self,
chat_id: impl Into<ChatId>,
user_id: i64,
) -> BanChatMember
pub fn ban_chat_member( &self, chat_id: impl Into<ChatId>, user_id: i64, ) -> BanChatMember
Calls banChatMember — bans a user from a chat.
Sourcepub fn unban_chat_member(
&self,
chat_id: impl Into<ChatId>,
user_id: i64,
) -> UnbanChatMember
pub fn unban_chat_member( &self, chat_id: impl Into<ChatId>, user_id: i64, ) -> UnbanChatMember
Calls unbanChatMember — lifts a ban from a user.
Sourcepub fn restrict_chat_member(
&self,
chat_id: impl Into<ChatId>,
user_id: i64,
permissions: ChatPermissions,
) -> RestrictChatMember
pub fn restrict_chat_member( &self, chat_id: impl Into<ChatId>, user_id: i64, permissions: ChatPermissions, ) -> RestrictChatMember
Calls restrictChatMember — restricts what a user can do in a chat.
Sourcepub fn promote_chat_member(
&self,
chat_id: impl Into<ChatId>,
user_id: i64,
) -> PromoteChatMember
pub fn promote_chat_member( &self, chat_id: impl Into<ChatId>, user_id: i64, ) -> PromoteChatMember
Calls promoteChatMember — grants or revokes admin privileges.
Sourcepub fn set_chat_administrator_custom_title(
&self,
chat_id: impl Into<ChatId>,
user_id: i64,
custom_title: impl Into<String>,
) -> SetChatAdministratorCustomTitle
pub fn set_chat_administrator_custom_title( &self, chat_id: impl Into<ChatId>, user_id: i64, custom_title: impl Into<String>, ) -> SetChatAdministratorCustomTitle
Calls setChatAdministratorCustomTitle — sets a custom title for an admin.
Sourcepub fn set_chat_member_tag(
&self,
chat_id: impl Into<ChatId>,
user_id: i64,
) -> SetChatMemberTag
pub fn set_chat_member_tag( &self, chat_id: impl Into<ChatId>, user_id: i64, ) -> SetChatMemberTag
Calls setChatMemberTag — sets a tag for a regular member (Bot API 9.5).
Sourcepub fn set_chat_permissions(
&self,
chat_id: impl Into<ChatId>,
permissions: ChatPermissions,
) -> SetChatPermissions
pub fn set_chat_permissions( &self, chat_id: impl Into<ChatId>, permissions: ChatPermissions, ) -> SetChatPermissions
Calls setChatPermissions — sets default chat permissions for all members.
Sourcepub fn export_chat_invite_link(
&self,
chat_id: impl Into<ChatId>,
) -> ExportChatInviteLink
pub fn export_chat_invite_link( &self, chat_id: impl Into<ChatId>, ) -> ExportChatInviteLink
Calls exportChatInviteLink — generates a new primary invite link, revoking the old one.
Sourcepub fn create_chat_invite_link(
&self,
chat_id: impl Into<ChatId>,
) -> CreateChatInviteLink
pub fn create_chat_invite_link( &self, chat_id: impl Into<ChatId>, ) -> CreateChatInviteLink
Calls createChatInviteLink — generates a new additional invite link.
Sourcepub fn edit_chat_invite_link(
&self,
chat_id: impl Into<ChatId>,
invite_link: impl Into<String>,
) -> EditChatInviteLink
pub fn edit_chat_invite_link( &self, chat_id: impl Into<ChatId>, invite_link: impl Into<String>, ) -> EditChatInviteLink
Calls editChatInviteLink — edits a non-primary invite link created by the bot.
Sourcepub fn revoke_chat_invite_link(
&self,
chat_id: impl Into<ChatId>,
invite_link: impl Into<String>,
) -> RevokeChatInviteLink
pub fn revoke_chat_invite_link( &self, chat_id: impl Into<ChatId>, invite_link: impl Into<String>, ) -> RevokeChatInviteLink
Calls revokeChatInviteLink — revokes an invite link created by the bot.
Sourcepub fn create_chat_subscription_invite_link(
&self,
chat_id: impl Into<ChatId>,
subscription_period: u32,
subscription_price: u32,
) -> CreateChatSubscriptionInviteLink
pub fn create_chat_subscription_invite_link( &self, chat_id: impl Into<ChatId>, subscription_period: u32, subscription_price: u32, ) -> CreateChatSubscriptionInviteLink
Calls createChatSubscriptionInviteLink — creates a subscription invite link for a channel.
Sourcepub fn edit_chat_subscription_invite_link(
&self,
chat_id: impl Into<ChatId>,
invite_link: impl Into<String>,
) -> EditChatSubscriptionInviteLink
pub fn edit_chat_subscription_invite_link( &self, chat_id: impl Into<ChatId>, invite_link: impl Into<String>, ) -> EditChatSubscriptionInviteLink
Calls editChatSubscriptionInviteLink — edits a subscription invite link.
Sourcepub fn approve_chat_join_request(
&self,
chat_id: impl Into<ChatId>,
user_id: i64,
) -> ApproveChatJoinRequest
pub fn approve_chat_join_request( &self, chat_id: impl Into<ChatId>, user_id: i64, ) -> ApproveChatJoinRequest
Calls approveChatJoinRequest — approves a pending join request.
Sourcepub fn decline_chat_join_request(
&self,
chat_id: impl Into<ChatId>,
user_id: i64,
) -> DeclineChatJoinRequest
pub fn decline_chat_join_request( &self, chat_id: impl Into<ChatId>, user_id: i64, ) -> DeclineChatJoinRequest
Calls declineChatJoinRequest — declines a pending join request.
Sourcepub fn answer_chat_join_request_query(
&self,
chat_join_request_query_id: impl Into<String>,
result: JoinRequestResult,
) -> AnswerChatJoinRequestQuery
pub fn answer_chat_join_request_query( &self, chat_join_request_query_id: impl Into<String>, result: JoinRequestResult, ) -> AnswerChatJoinRequestQuery
Calls answerChatJoinRequestQuery — processes a join request query (Bot API 10.1).
Must be called within 10 seconds of receiving a ChatJoinRequest
that carries a query_id.
Sourcepub fn send_chat_join_request_web_app(
&self,
chat_join_request_query_id: impl Into<String>,
web_app_url: impl Into<String>,
) -> SendChatJoinRequestWebApp
pub fn send_chat_join_request_web_app( &self, chat_join_request_query_id: impl Into<String>, web_app_url: impl Into<String>, ) -> SendChatJoinRequestWebApp
Calls sendChatJoinRequestWebApp — shows a Mini App to the user before deciding (Bot API 10.1).
Must be called within 10 seconds of receiving a ChatJoinRequest
that carries a query_id.
Sourcepub fn ban_chat_sender_chat(
&self,
chat_id: impl Into<ChatId>,
sender_chat_id: i64,
) -> BanChatSenderChat
pub fn ban_chat_sender_chat( &self, chat_id: impl Into<ChatId>, sender_chat_id: i64, ) -> BanChatSenderChat
Calls banChatSenderChat — bans a channel chat from sending in a supergroup or channel.
Sourcepub fn unban_chat_sender_chat(
&self,
chat_id: impl Into<ChatId>,
sender_chat_id: i64,
) -> UnbanChatSenderChat
pub fn unban_chat_sender_chat( &self, chat_id: impl Into<ChatId>, sender_chat_id: i64, ) -> UnbanChatSenderChat
Calls unbanChatSenderChat — unbans a previously banned channel chat.
Sourcepub fn unpin_all_chat_messages(
&self,
chat_id: impl Into<ChatId>,
) -> UnpinAllChatMessages
pub fn unpin_all_chat_messages( &self, chat_id: impl Into<ChatId>, ) -> UnpinAllChatMessages
Calls unpinAllChatMessages — clears all pinned messages in a chat.
Sourcepub fn set_chat_photo(
&self,
chat_id: impl Into<ChatId>,
photo: InputFile,
) -> SetChatPhoto
pub fn set_chat_photo( &self, chat_id: impl Into<ChatId>, photo: InputFile, ) -> SetChatPhoto
Calls setChatPhoto — sets a new profile photo for the chat.
Sourcepub fn delete_chat_photo(&self, chat_id: impl Into<ChatId>) -> DeleteChatPhoto
pub fn delete_chat_photo(&self, chat_id: impl Into<ChatId>) -> DeleteChatPhoto
Calls deleteChatPhoto — deletes the chat photo.
Sourcepub fn set_chat_title(
&self,
chat_id: impl Into<ChatId>,
title: impl Into<String>,
) -> SetChatTitle
pub fn set_chat_title( &self, chat_id: impl Into<ChatId>, title: impl Into<String>, ) -> SetChatTitle
Calls setChatTitle — changes the title of a chat.
Sourcepub fn set_chat_description(
&self,
chat_id: impl Into<ChatId>,
) -> SetChatDescription
pub fn set_chat_description( &self, chat_id: impl Into<ChatId>, ) -> SetChatDescription
Calls setChatDescription — changes the description of a group, supergroup, or channel.
Sourcepub fn set_chat_sticker_set(
&self,
chat_id: impl Into<ChatId>,
sticker_set_name: impl Into<String>,
) -> SetChatStickerSet
pub fn set_chat_sticker_set( &self, chat_id: impl Into<ChatId>, sticker_set_name: impl Into<String>, ) -> SetChatStickerSet
Calls setChatStickerSet — sets the sticker set for a supergroup.
Sourcepub fn delete_chat_sticker_set(
&self,
chat_id: impl Into<ChatId>,
) -> DeleteChatStickerSet
pub fn delete_chat_sticker_set( &self, chat_id: impl Into<ChatId>, ) -> DeleteChatStickerSet
Calls deleteChatStickerSet — removes the sticker set from a supergroup.
Sourcepub fn leave_chat(&self, chat_id: impl Into<ChatId>) -> LeaveChat
pub fn leave_chat(&self, chat_id: impl Into<ChatId>) -> LeaveChat
Calls leaveChat — makes the bot leave a group, supergroup, or channel.
Sourcepub fn get_user_chat_boosts(
&self,
chat_id: impl Into<ChatId>,
user_id: i64,
) -> GetUserChatBoosts
pub fn get_user_chat_boosts( &self, chat_id: impl Into<ChatId>, user_id: i64, ) -> GetUserChatBoosts
Calls getUserChatBoosts — returns the boosts added to a chat by a user.
Sourcepub fn pin_chat_message(
&self,
chat_id: impl Into<ChatId>,
message_id: i64,
) -> PinChatMessage
pub fn pin_chat_message( &self, chat_id: impl Into<ChatId>, message_id: i64, ) -> PinChatMessage
Calls pinChatMessage — pins a message in a chat.
Sourcepub fn unpin_chat_message(&self, chat_id: impl Into<ChatId>) -> UnpinChatMessage
pub fn unpin_chat_message(&self, chat_id: impl Into<ChatId>) -> UnpinChatMessage
Calls unpinChatMessage — unpins a message in a chat.
Sourcepub fn close(&self) -> Close
pub fn close(&self) -> Close
Calls close — closes the bot instance before moving it to another server.
Sourcepub fn set_my_commands(&self, commands: Vec<BotCommand>) -> SetMyCommands
pub fn set_my_commands(&self, commands: Vec<BotCommand>) -> SetMyCommands
Calls setMyCommands — sets the bot’s command list.
Sourcepub fn delete_my_commands(&self) -> DeleteMyCommands
pub fn delete_my_commands(&self) -> DeleteMyCommands
Calls deleteMyCommands — deletes the bot’s command list for a given scope and language.
Sourcepub fn get_my_commands(&self) -> GetMyCommands
pub fn get_my_commands(&self) -> GetMyCommands
Calls getMyCommands — returns the bot’s current command list.
Sourcepub fn set_my_name(&self) -> SetMyName
pub fn set_my_name(&self) -> SetMyName
Calls setMyName — changes the bot’s display name.
Sourcepub fn get_my_name(&self) -> GetMyName
pub fn get_my_name(&self) -> GetMyName
Calls getMyName — returns the bot’s current display name.
Sourcepub fn set_my_description(&self) -> SetMyDescription
pub fn set_my_description(&self) -> SetMyDescription
Calls setMyDescription — changes the bot’s profile description.
Sourcepub fn get_my_description(&self) -> GetMyDescription
pub fn get_my_description(&self) -> GetMyDescription
Calls getMyDescription — returns the bot’s current profile description.
Sourcepub fn set_my_short_description(&self) -> SetMyShortDescription
pub fn set_my_short_description(&self) -> SetMyShortDescription
Calls setMyShortDescription — changes the bot’s short description.
Sourcepub fn get_my_short_description(&self) -> GetMyShortDescription
pub fn get_my_short_description(&self) -> GetMyShortDescription
Calls getMyShortDescription — returns the bot’s current short description.
Sourcepub fn set_my_default_administrator_rights(
&self,
) -> SetMyDefaultAdministratorRights
pub fn set_my_default_administrator_rights( &self, ) -> SetMyDefaultAdministratorRights
Calls setMyDefaultAdministratorRights — sets the default admin rights suggested to users.
Sourcepub fn get_my_default_administrator_rights(
&self,
) -> GetMyDefaultAdministratorRights
pub fn get_my_default_administrator_rights( &self, ) -> GetMyDefaultAdministratorRights
Calls getMyDefaultAdministratorRights — returns the bot’s current default admin rights.
Calls getChatMenuButton — returns the current menu button for a private chat.
Calls setChatMenuButton — changes the bot’s menu button in a private chat or globally.
Sourcepub fn set_my_profile_photo(
&self,
photo: InputProfilePhoto,
) -> SetMyProfilePhoto
pub fn set_my_profile_photo( &self, photo: InputProfilePhoto, ) -> SetMyProfilePhoto
Calls setMyProfilePhoto — changes the bot’s profile photo (Bot API 9.4).
Sourcepub fn remove_my_profile_photo(&self) -> RemoveMyProfilePhoto
pub fn remove_my_profile_photo(&self) -> RemoveMyProfilePhoto
Calls removeMyProfilePhoto — removes the bot’s current profile photo (Bot API 9.4).
Sourcepub fn get_managed_bot_token(&self, user_id: i64) -> GetManagedBotToken
pub fn get_managed_bot_token(&self, user_id: i64) -> GetManagedBotToken
Calls getManagedBotToken — returns the token of a managed bot (Bot API 9.6).
Sourcepub fn replace_managed_bot_token(&self, user_id: i64) -> ReplaceManagedBotToken
pub fn replace_managed_bot_token(&self, user_id: i64) -> ReplaceManagedBotToken
Calls replaceManagedBotToken — revokes and regenerates a managed bot’s token (Bot API 9.6).
Sourcepub fn get_managed_bot_access_settings(
&self,
user_id: i64,
) -> GetManagedBotAccessSettings
pub fn get_managed_bot_access_settings( &self, user_id: i64, ) -> GetManagedBotAccessSettings
Calls getManagedBotAccessSettings — returns the access settings of a managed bot (Bot API 9.7).
Sourcepub fn set_managed_bot_access_settings(
&self,
user_id: i64,
is_access_restricted: bool,
) -> SetManagedBotAccessSettings
pub fn set_managed_bot_access_settings( &self, user_id: i64, is_access_restricted: bool, ) -> SetManagedBotAccessSettings
Calls setManagedBotAccessSettings — changes the access settings of a managed bot (Bot API 9.7).
Sourcepub fn post_story(
&self,
business_connection_id: impl Into<String>,
content: InputStoryContent,
active_period: u32,
) -> PostStory
pub fn post_story( &self, business_connection_id: impl Into<String>, content: InputStoryContent, active_period: u32, ) -> PostStory
Calls postStory — posts a story on behalf of a managed business account.
active_period must be one of 21600, 43200, 86400, or 172800 seconds.
Sourcepub fn repost_story(
&self,
business_connection_id: impl Into<String>,
from_chat_id: i64,
from_story_id: i64,
active_period: u32,
) -> RepostStory
pub fn repost_story( &self, business_connection_id: impl Into<String>, from_chat_id: i64, from_story_id: i64, active_period: u32, ) -> RepostStory
Calls repostStory — reposts a story from one managed business account to another.
active_period must be one of 21600, 43200, 86400, or 172800 seconds.
Sourcepub fn edit_story(
&self,
business_connection_id: impl Into<String>,
story_id: i64,
content: InputStoryContent,
) -> EditStory
pub fn edit_story( &self, business_connection_id: impl Into<String>, story_id: i64, content: InputStoryContent, ) -> EditStory
Calls editStory — edits a story posted by the bot on behalf of a business account.
Sourcepub fn delete_story(
&self,
business_connection_id: impl Into<String>,
story_id: i64,
) -> DeleteStory
pub fn delete_story( &self, business_connection_id: impl Into<String>, story_id: i64, ) -> DeleteStory
Calls deleteStory — deletes a story posted by the bot on behalf of a business account.
Sourcepub fn get_available_gifts(&self) -> GetAvailableGifts
pub fn get_available_gifts(&self) -> GetAvailableGifts
Calls getAvailableGifts — returns all gifts the bot can send.
Sourcepub fn send_gift(&self, gift_id: impl Into<String>) -> SendGift
pub fn send_gift(&self, gift_id: impl Into<String>) -> SendGift
Calls sendGift — sends a gift to a user or channel chat.
Chain .user_id(id) or .chat_id(id) to specify the recipient.
Calls giftPremiumSubscription — gifts a Telegram Premium subscription to a user.
month_count must be 3, 6, or 12.
star_count must be 1000, 1500, or 2500 respectively.
Sourcepub fn get_business_account_gifts(
&self,
business_connection_id: impl Into<String>,
) -> GetBusinessAccountGifts
pub fn get_business_account_gifts( &self, business_connection_id: impl Into<String>, ) -> GetBusinessAccountGifts
Calls getBusinessAccountGifts — returns gifts received by a managed business account.
Sourcepub fn get_user_gifts(&self, user_id: i64) -> GetUserGifts
pub fn get_user_gifts(&self, user_id: i64) -> GetUserGifts
Calls getUserGifts — returns gifts owned by a user.
Sourcepub fn get_chat_gifts(&self, chat_id: impl Into<ChatId>) -> GetChatGifts
pub fn get_chat_gifts(&self, chat_id: impl Into<ChatId>) -> GetChatGifts
Calls getChatGifts — returns gifts owned by a channel chat.
Sourcepub fn convert_gift_to_stars(
&self,
business_connection_id: impl Into<String>,
owned_gift_id: impl Into<String>,
) -> ConvertGiftToStars
pub fn convert_gift_to_stars( &self, business_connection_id: impl Into<String>, owned_gift_id: impl Into<String>, ) -> ConvertGiftToStars
Calls convertGiftToStars — converts a business account gift to Telegram Stars.
Sourcepub fn upgrade_gift(
&self,
business_connection_id: impl Into<String>,
owned_gift_id: impl Into<String>,
) -> UpgradeGift
pub fn upgrade_gift( &self, business_connection_id: impl Into<String>, owned_gift_id: impl Into<String>, ) -> UpgradeGift
Calls upgradeGift — upgrades a regular gift to a unique gift.
Sourcepub fn transfer_gift(
&self,
business_connection_id: impl Into<String>,
owned_gift_id: impl Into<String>,
new_owner_chat_id: i64,
) -> TransferGift
pub fn transfer_gift( &self, business_connection_id: impl Into<String>, owned_gift_id: impl Into<String>, new_owner_chat_id: i64, ) -> TransferGift
Calls transferGift — transfers a unique gift to another user.
Sourcepub fn set_message_reaction(
&self,
chat_id: impl Into<ChatId>,
message_id: i64,
) -> SetMessageReaction
pub fn set_message_reaction( &self, chat_id: impl Into<ChatId>, message_id: i64, ) -> SetMessageReaction
Calls setMessageReaction — sets a reaction on a message.
Sourcepub fn delete_message_reaction(
&self,
chat_id: impl Into<ChatId>,
message_id: i64,
) -> DeleteMessageReaction
pub fn delete_message_reaction( &self, chat_id: impl Into<ChatId>, message_id: i64, ) -> DeleteMessageReaction
Calls deleteMessageReaction — removes a specific reaction from a message (Bot API 9.7).
Sourcepub fn delete_all_message_reactions(
&self,
chat_id: impl Into<ChatId>,
) -> DeleteAllMessageReactions
pub fn delete_all_message_reactions( &self, chat_id: impl Into<ChatId>, ) -> DeleteAllMessageReactions
Calls deleteAllMessageReactions — removes all recent reactions by a given user or chat (Bot API 9.7).
Sourcepub fn answer_inline_query(
&self,
inline_query_id: impl Into<String>,
results: Vec<InlineQueryResult>,
) -> AnswerInlineQuery
pub fn answer_inline_query( &self, inline_query_id: impl Into<String>, results: Vec<InlineQueryResult>, ) -> AnswerInlineQuery
Calls answerInlineQuery — sends up to 50 results for an inline query.
Sourcepub fn answer_web_app_query(
&self,
web_app_query_id: impl Into<String>,
result: InlineQueryResult,
) -> AnswerWebAppQuery
pub fn answer_web_app_query( &self, web_app_query_id: impl Into<String>, result: InlineQueryResult, ) -> AnswerWebAppQuery
Calls answerWebAppQuery — sets the result of a Web App interaction and sends it to the chat.
Sourcepub fn answer_guest_query(
&self,
guest_query_id: impl Into<String>,
result: InlineQueryResult,
) -> AnswerGuestQuery
pub fn answer_guest_query( &self, guest_query_id: impl Into<String>, result: InlineQueryResult, ) -> AnswerGuestQuery
Calls answerGuestQuery — replies to a received guest message (Bot API 9.7).
Sourcepub fn save_prepared_inline_message(
&self,
user_id: i64,
result: InlineQueryResult,
) -> SavePreparedInlineMessage
pub fn save_prepared_inline_message( &self, user_id: i64, result: InlineQueryResult, ) -> SavePreparedInlineMessage
Calls savePreparedInlineMessage — stores a message sendable by a Mini App user.
Calls savePreparedKeyboardButton — stores a keyboard button for use in a Mini App (Bot API 9.6).
The button must be of type request_users, request_chat, or request_managed_bot.
Sourcepub fn set_user_emoji_status(&self, user_id: i64) -> SetUserEmojiStatus
pub fn set_user_emoji_status(&self, user_id: i64) -> SetUserEmojiStatus
Calls setUserEmojiStatus — changes a user’s emoji status via a Mini App.
Sourcepub fn set_passport_data_errors(
&self,
user_id: i64,
errors: Vec<PassportElementError>,
) -> SetPassportDataErrors
pub fn set_passport_data_errors( &self, user_id: i64, errors: Vec<PassportElementError>, ) -> SetPassportDataErrors
Calls setPassportDataErrors — reports errors in Telegram Passport elements.
Sourcepub fn set_game_score(&self, user_id: i64, score: u32) -> SetGameScore
pub fn set_game_score(&self, user_id: i64, score: u32) -> SetGameScore
Calls setGameScore — sets a user’s score in a game.
Chain .chat_message(chat_id, message_id) or .inline_message_id(id) to target the message.
Sourcepub fn get_game_high_scores(&self, user_id: i64) -> GetGameHighScores
pub fn get_game_high_scores(&self, user_id: i64) -> GetGameHighScores
Calls getGameHighScores — returns high scores for a game.
Chain .chat_message(chat_id, message_id) or .inline_message_id(id) to target the message.
Sourcepub fn send_invoice(
&self,
chat_id: impl Into<ChatId>,
title: impl Into<String>,
description: impl Into<String>,
payload: impl Into<String>,
currency: impl Into<String>,
prices: Vec<LabeledPrice>,
) -> SendInvoice
pub fn send_invoice( &self, chat_id: impl Into<ChatId>, title: impl Into<String>, description: impl Into<String>, payload: impl Into<String>, currency: impl Into<String>, prices: Vec<LabeledPrice>, ) -> SendInvoice
Calls sendInvoice — sends a payment invoice.
Sourcepub fn create_invoice_link(
&self,
title: impl Into<String>,
description: impl Into<String>,
payload: impl Into<String>,
currency: impl Into<String>,
prices: Vec<LabeledPrice>,
) -> CreateInvoiceLink
pub fn create_invoice_link( &self, title: impl Into<String>, description: impl Into<String>, payload: impl Into<String>, currency: impl Into<String>, prices: Vec<LabeledPrice>, ) -> CreateInvoiceLink
Calls createInvoiceLink — creates a shareable payment link.
Sourcepub fn answer_shipping_query(
&self,
shipping_query_id: impl Into<String>,
ok: bool,
) -> AnswerShippingQuery
pub fn answer_shipping_query( &self, shipping_query_id: impl Into<String>, ok: bool, ) -> AnswerShippingQuery
Calls answerShippingQuery — responds to a shipping query from a user.
Pass ok = true and provide shipping_options; or ok = false with an error_message.
Sourcepub fn answer_pre_checkout_query(
&self,
pre_checkout_query_id: impl Into<String>,
ok: bool,
) -> AnswerPreCheckoutQuery
pub fn answer_pre_checkout_query( &self, pre_checkout_query_id: impl Into<String>, ok: bool, ) -> AnswerPreCheckoutQuery
Calls answerPreCheckoutQuery — confirms or rejects a pre-checkout query.
Must be called within 10 seconds of receiving the query.
Sourcepub fn refund_star_payment(
&self,
user_id: i64,
telegram_payment_charge_id: impl Into<String>,
) -> RefundStarPayment
pub fn refund_star_payment( &self, user_id: i64, telegram_payment_charge_id: impl Into<String>, ) -> RefundStarPayment
Calls refundStarPayment — refunds a successful Telegram Stars payment.
Sourcepub fn edit_user_star_subscription(
&self,
user_id: i64,
telegram_payment_charge_id: impl Into<String>,
is_canceled: bool,
) -> EditUserStarSubscription
pub fn edit_user_star_subscription( &self, user_id: i64, telegram_payment_charge_id: impl Into<String>, is_canceled: bool, ) -> EditUserStarSubscription
Calls editUserStarSubscription — cancels or re-enables a Stars subscription.
Sourcepub fn get_my_star_balance(&self) -> GetMyStarBalance
pub fn get_my_star_balance(&self) -> GetMyStarBalance
Calls getMyStarBalance — returns the bot’s Telegram Star balance.
Sourcepub fn get_star_transactions(&self) -> GetStarTransactions
pub fn get_star_transactions(&self) -> GetStarTransactions
Calls getStarTransactions — returns the bot’s Star transaction history.
Sourcepub fn get_sticker_set(&self, name: impl Into<String>) -> GetStickerSet
pub fn get_sticker_set(&self, name: impl Into<String>) -> GetStickerSet
Calls getStickerSet — returns a sticker set by name.
Sourcepub fn get_custom_emoji_stickers(
&self,
ids: Vec<impl Into<String>>,
) -> GetCustomEmojiStickers
pub fn get_custom_emoji_stickers( &self, ids: Vec<impl Into<String>>, ) -> GetCustomEmojiStickers
Calls getCustomEmojiStickers — returns stickers for the given custom emoji IDs.
Sourcepub fn upload_sticker_file(
&self,
user_id: i64,
sticker: InputFile,
format: StickerFormat,
) -> UploadStickerFile
pub fn upload_sticker_file( &self, user_id: i64, sticker: InputFile, format: StickerFormat, ) -> UploadStickerFile
Calls uploadStickerFile — uploads a sticker file for later use in a set.
Sourcepub fn create_new_sticker_set(
&self,
user_id: i64,
name: impl Into<String>,
title: impl Into<String>,
stickers: Vec<InputSticker>,
) -> CreateNewStickerSet
pub fn create_new_sticker_set( &self, user_id: i64, name: impl Into<String>, title: impl Into<String>, stickers: Vec<InputSticker>, ) -> CreateNewStickerSet
Calls createNewStickerSet — creates a new sticker set owned by a user.
Sourcepub fn add_sticker_to_set(
&self,
user_id: i64,
name: impl Into<String>,
sticker: InputSticker,
) -> AddStickerToSet
pub fn add_sticker_to_set( &self, user_id: i64, name: impl Into<String>, sticker: InputSticker, ) -> AddStickerToSet
Calls addStickerToSet — adds a new sticker to an existing set.
Sourcepub fn set_sticker_position_in_set(
&self,
sticker: impl Into<String>,
position: u32,
) -> SetStickerPositionInSet
pub fn set_sticker_position_in_set( &self, sticker: impl Into<String>, position: u32, ) -> SetStickerPositionInSet
Calls setStickerPositionInSet — moves a sticker to a new position in its set.
Sourcepub fn delete_sticker_from_set(
&self,
sticker: impl Into<String>,
) -> DeleteStickerFromSet
pub fn delete_sticker_from_set( &self, sticker: impl Into<String>, ) -> DeleteStickerFromSet
Calls deleteStickerFromSet — removes a sticker from its set.
Sourcepub fn set_sticker_emoji_list(
&self,
sticker: impl Into<String>,
emoji_list: Vec<impl Into<String>>,
) -> SetStickerEmojiList
pub fn set_sticker_emoji_list( &self, sticker: impl Into<String>, emoji_list: Vec<impl Into<String>>, ) -> SetStickerEmojiList
Calls setStickerEmojiList — updates the emoji list for a sticker.
Sourcepub fn set_sticker_keywords(
&self,
sticker: impl Into<String>,
) -> SetStickerKeywords
pub fn set_sticker_keywords( &self, sticker: impl Into<String>, ) -> SetStickerKeywords
Calls setStickerKeywords — updates the search keywords for a sticker.
Sourcepub fn set_sticker_mask_position(
&self,
sticker: impl Into<String>,
) -> SetStickerMaskPosition
pub fn set_sticker_mask_position( &self, sticker: impl Into<String>, ) -> SetStickerMaskPosition
Calls setStickerMaskPosition — updates the mask position for a mask sticker.
Sourcepub fn set_sticker_set_title(
&self,
name: impl Into<String>,
title: impl Into<String>,
) -> SetStickerSetTitle
pub fn set_sticker_set_title( &self, name: impl Into<String>, title: impl Into<String>, ) -> SetStickerSetTitle
Calls setStickerSetTitle — renames a sticker set.
Sourcepub fn delete_sticker_set(&self, name: impl Into<String>) -> DeleteStickerSet
pub fn delete_sticker_set(&self, name: impl Into<String>) -> DeleteStickerSet
Calls deleteStickerSet — deletes a sticker set created by the bot.
Sourcepub fn replace_sticker_in_set(
&self,
user_id: i64,
name: impl Into<String>,
old_sticker: impl Into<String>,
sticker: InputSticker,
) -> ReplaceStickerInSet
pub fn replace_sticker_in_set( &self, user_id: i64, name: impl Into<String>, old_sticker: impl Into<String>, sticker: InputSticker, ) -> ReplaceStickerInSet
Calls replaceStickerInSet — replaces an existing sticker in a set with a new one.
Sourcepub fn set_sticker_set_thumbnail(
&self,
name: impl Into<String>,
user_id: i64,
format: impl Into<String>,
) -> SetStickerSetThumbnail
pub fn set_sticker_set_thumbnail( &self, name: impl Into<String>, user_id: i64, format: impl Into<String>, ) -> SetStickerSetThumbnail
Calls setStickerSetThumbnail — sets the thumbnail of a regular or mask sticker set.
format must be "static", "animated", or "video".
Chain .thumbnail(file) to set the thumbnail; omit to drop it.
Sourcepub fn set_custom_emoji_sticker_set_thumbnail(
&self,
name: impl Into<String>,
) -> SetCustomEmojiStickerSetThumbnail
pub fn set_custom_emoji_sticker_set_thumbnail( &self, name: impl Into<String>, ) -> SetCustomEmojiStickerSetThumbnail
Calls setCustomEmojiStickerSetThumbnail — sets the thumbnail of a custom emoji sticker set.
Chain .custom_emoji_id(id) to set the thumbnail emoji; omit to use the first sticker.
Sourcepub fn get_forum_topic_icon_stickers(&self) -> GetForumTopicIconStickers
pub fn get_forum_topic_icon_stickers(&self) -> GetForumTopicIconStickers
Calls getForumTopicIconStickers — returns all available forum topic icon stickers.
Sourcepub fn create_forum_topic(
&self,
chat_id: impl Into<ChatId>,
name: impl Into<String>,
) -> CreateForumTopic
pub fn create_forum_topic( &self, chat_id: impl Into<ChatId>, name: impl Into<String>, ) -> CreateForumTopic
Calls createForumTopic — creates a new topic in a forum supergroup.
Sourcepub fn edit_forum_topic(
&self,
chat_id: impl Into<ChatId>,
thread_id: i64,
) -> EditForumTopic
pub fn edit_forum_topic( &self, chat_id: impl Into<ChatId>, thread_id: i64, ) -> EditForumTopic
Calls editForumTopic — edits the name or icon of a forum topic.
Sourcepub fn close_forum_topic(
&self,
chat_id: impl Into<ChatId>,
thread_id: i64,
) -> CloseForumTopic
pub fn close_forum_topic( &self, chat_id: impl Into<ChatId>, thread_id: i64, ) -> CloseForumTopic
Calls closeForumTopic — closes an open forum topic.
Sourcepub fn reopen_forum_topic(
&self,
chat_id: impl Into<ChatId>,
thread_id: i64,
) -> ReopenForumTopic
pub fn reopen_forum_topic( &self, chat_id: impl Into<ChatId>, thread_id: i64, ) -> ReopenForumTopic
Calls reopenForumTopic — reopens a closed forum topic.
Sourcepub fn delete_forum_topic(
&self,
chat_id: impl Into<ChatId>,
thread_id: i64,
) -> DeleteForumTopic
pub fn delete_forum_topic( &self, chat_id: impl Into<ChatId>, thread_id: i64, ) -> DeleteForumTopic
Calls deleteForumTopic — deletes a forum topic and all its messages.
Sourcepub fn edit_general_forum_topic(
&self,
chat_id: impl Into<ChatId>,
name: impl Into<String>,
) -> EditGeneralForumTopic
pub fn edit_general_forum_topic( &self, chat_id: impl Into<ChatId>, name: impl Into<String>, ) -> EditGeneralForumTopic
Calls editGeneralForumTopic — renames the General topic.
Sourcepub fn close_general_forum_topic(
&self,
chat_id: impl Into<ChatId>,
) -> CloseGeneralForumTopic
pub fn close_general_forum_topic( &self, chat_id: impl Into<ChatId>, ) -> CloseGeneralForumTopic
Calls closeGeneralForumTopic — closes the General topic.
Sourcepub fn reopen_general_forum_topic(
&self,
chat_id: impl Into<ChatId>,
) -> ReopenGeneralForumTopic
pub fn reopen_general_forum_topic( &self, chat_id: impl Into<ChatId>, ) -> ReopenGeneralForumTopic
Calls reopenGeneralForumTopic — reopens the General topic.
Sourcepub fn hide_general_forum_topic(
&self,
chat_id: impl Into<ChatId>,
) -> HideGeneralForumTopic
pub fn hide_general_forum_topic( &self, chat_id: impl Into<ChatId>, ) -> HideGeneralForumTopic
Calls hideGeneralForumTopic — hides the General topic from the topic list.
Sourcepub fn unhide_general_forum_topic(
&self,
chat_id: impl Into<ChatId>,
) -> UnhideGeneralForumTopic
pub fn unhide_general_forum_topic( &self, chat_id: impl Into<ChatId>, ) -> UnhideGeneralForumTopic
Calls unhideGeneralForumTopic — makes the General topic visible again.
Sourcepub fn unpin_all_general_forum_topic_messages(
&self,
chat_id: impl Into<ChatId>,
) -> UnpinAllGeneralForumTopicMessages
pub fn unpin_all_general_forum_topic_messages( &self, chat_id: impl Into<ChatId>, ) -> UnpinAllGeneralForumTopicMessages
Calls unpinAllGeneralForumTopicMessages — clears all pinned messages in the General forum topic.
Sourcepub fn verify_user(&self, user_id: i64) -> VerifyUser
pub fn verify_user(&self, user_id: i64) -> VerifyUser
Calls verifyUser — verifies a user on behalf of the organisation.
Sourcepub fn verify_chat(&self, chat_id: impl Into<ChatId>) -> VerifyChat
pub fn verify_chat(&self, chat_id: impl Into<ChatId>) -> VerifyChat
Calls verifyChat — verifies a chat on behalf of the organisation.
Sourcepub fn remove_user_verification(&self, user_id: i64) -> RemoveUserVerification
pub fn remove_user_verification(&self, user_id: i64) -> RemoveUserVerification
Calls removeUserVerification — removes verification from a user.
Sourcepub fn remove_chat_verification(
&self,
chat_id: impl Into<ChatId>,
) -> RemoveChatVerification
pub fn remove_chat_verification( &self, chat_id: impl Into<ChatId>, ) -> RemoveChatVerification
Calls removeChatVerification — removes verification from a chat.
Sourcepub fn get_business_connection(
&self,
id: impl Into<String>,
) -> GetBusinessConnection
pub fn get_business_connection( &self, id: impl Into<String>, ) -> GetBusinessConnection
Calls getBusinessConnection — returns business connection information.
Sourcepub fn read_business_message(
&self,
business_connection_id: impl Into<String>,
chat_id: impl Into<ChatId>,
message_id: i64,
) -> ReadBusinessMessage
pub fn read_business_message( &self, business_connection_id: impl Into<String>, chat_id: impl Into<ChatId>, message_id: i64, ) -> ReadBusinessMessage
Calls readBusinessMessage — marks a business account message as read.
Sourcepub fn delete_business_messages(
&self,
business_connection_id: impl Into<String>,
message_ids: Vec<i64>,
) -> DeleteBusinessMessages
pub fn delete_business_messages( &self, business_connection_id: impl Into<String>, message_ids: Vec<i64>, ) -> DeleteBusinessMessages
Calls deleteBusinessMessages — deletes messages from a business account.
Sourcepub fn set_business_account_name(
&self,
business_connection_id: impl Into<String>,
first_name: impl Into<String>,
last_name: Option<String>,
) -> SetBusinessAccountName
pub fn set_business_account_name( &self, business_connection_id: impl Into<String>, first_name: impl Into<String>, last_name: Option<String>, ) -> SetBusinessAccountName
Calls setBusinessAccountName — sets the name of a managed business account.
Sourcepub fn set_business_account_username(
&self,
business_connection_id: impl Into<String>,
username: Option<String>,
) -> SetBusinessAccountUsername
pub fn set_business_account_username( &self, business_connection_id: impl Into<String>, username: Option<String>, ) -> SetBusinessAccountUsername
Calls setBusinessAccountUsername — sets the username of a managed business account.
Sourcepub fn set_business_account_bio(
&self,
business_connection_id: impl Into<String>,
bio: Option<String>,
) -> SetBusinessAccountBio
pub fn set_business_account_bio( &self, business_connection_id: impl Into<String>, bio: Option<String>, ) -> SetBusinessAccountBio
Calls setBusinessAccountBio — sets the bio of a managed business account.
Sourcepub fn get_business_account_star_balance(
&self,
business_connection_id: impl Into<String>,
) -> GetBusinessAccountStarBalance
pub fn get_business_account_star_balance( &self, business_connection_id: impl Into<String>, ) -> GetBusinessAccountStarBalance
Calls getBusinessAccountStarBalance — returns a business account’s Star balance.
Sourcepub fn transfer_business_account_stars(
&self,
business_connection_id: impl Into<String>,
star_count: u64,
) -> TransferBusinessAccountStars
pub fn transfer_business_account_stars( &self, business_connection_id: impl Into<String>, star_count: u64, ) -> TransferBusinessAccountStars
Calls transferBusinessAccountStars — transfers Stars from a business account to the bot.
Sourcepub fn unpin_all_forum_topic_messages(
&self,
chat_id: impl Into<ChatId>,
thread_id: i64,
) -> UnpinAllForumTopicMessages
pub fn unpin_all_forum_topic_messages( &self, chat_id: impl Into<ChatId>, thread_id: i64, ) -> UnpinAllForumTopicMessages
Calls unpinAllForumTopicMessages — clears all pinned messages in a forum topic.
Sourcepub fn set_business_account_profile_photo(
&self,
business_connection_id: impl Into<String>,
photo: InputProfilePhoto,
) -> SetBusinessAccountProfilePhoto
pub fn set_business_account_profile_photo( &self, business_connection_id: impl Into<String>, photo: InputProfilePhoto, ) -> SetBusinessAccountProfilePhoto
Calls setBusinessAccountProfilePhoto — sets the profile photo of a managed business account.
Pass photo as serde_json::to_value(&input_profile_photo).
Sourcepub fn remove_business_account_profile_photo(
&self,
business_connection_id: impl Into<String>,
) -> RemoveBusinessAccountProfilePhoto
pub fn remove_business_account_profile_photo( &self, business_connection_id: impl Into<String>, ) -> RemoveBusinessAccountProfilePhoto
Calls removeBusinessAccountProfilePhoto — removes the profile photo of a managed business account.
Sourcepub fn set_business_account_gift_settings(
&self,
business_connection_id: impl Into<String>,
show_gift_button: bool,
accepted_gift_types: AcceptedGiftTypes,
) -> SetBusinessAccountGiftSettings
pub fn set_business_account_gift_settings( &self, business_connection_id: impl Into<String>, show_gift_button: bool, accepted_gift_types: AcceptedGiftTypes, ) -> SetBusinessAccountGiftSettings
Calls setBusinessAccountGiftSettings — changes gift privacy settings for a managed business account.