telega/api
This module provides an interface for interacting with the Telegram Bot API.
It will be useful if you want to interact with the Telegram Bot API directly, without running a bot.
But it will be more convenient to use the reply
module in bot handlers.
Values
pub fn add_sticker_to_set(
client client: client.TelegramClient,
parameters parameters: types.AddStickerToSetParameters,
) -> Result(Bool, error.TelegaError)
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.
Official reference: https://core.telegram.org/bots/api#addstickertoset
pub fn answer_callback_query(
client client: client.TelegramClient,
parameters parameters: types.AnswerCallbackQueryParameters,
) -> Result(Bool, error.TelegaError)
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.
Official reference: https://core.telegram.org/bots/api#answercallbackquery
pub fn answer_inline_query(
client client: client.TelegramClient,
parameters parameters: types.AnswerInlineQueryParameters,
) -> Result(Bool, error.TelegaError)
Use this method to send answers to an inline query. On success, True is returned. No more than 50 results per query are allowed.
Official reference: https://core.telegram.org/bots/api#answerinlinequery
pub fn answer_pre_checkout_query(
client client: client.TelegramClient,
parameters parameters: types.AnswerPreCheckoutQueryParameters,
) -> Result(Bool, error.TelegaError)
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.
Official reference: https://core.telegram.org/bots/api#answerprecheckoutquery
pub fn answer_shipping_query(
client client: client.TelegramClient,
parameters parameters: types.AnswerShippingQueryParameters,
) -> Result(Bool, error.TelegaError)
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.
Official reference: https://core.telegram.org/bots/api#answershippingquery
pub fn approve_chat_join_request(
client client: client.TelegramClient,
parameters parameters: types.ApproveChatJoinRequestParameters,
) -> Result(response.Response(String), error.TelegaError)
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.
Official reference: https://core.telegram.org/bots/api#approvechatjoinrequest
pub fn ban_chat_member(
client client: client.TelegramClient,
parameters parameters: types.BanChatMemberParameters,
) -> Result(Bool, error.TelegaError)
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.
Official reference: https://core.telegram.org/bots/api#banchatmember
pub fn ban_chat_sender_chat(
client client: client.TelegramClient,
parameters parameters: types.BanChatSenderChatParameters,
) -> Result(Bool, error.TelegaError)
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.
Official reference: https://core.telegram.org/bots/api#banchatsenderchat
pub fn close(
client client: client.TelegramClient,
) -> Result(Bool, error.TelegaError)
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.
Official reference: https://core.telegram.org/bots/api#close
pub fn close_forum_topic(
client client: client.TelegramClient,
parameters parameters: types.CloseForumTopicParameters,
) -> Result(Bool, error.TelegaError)
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.
Official reference: https://core.telegram.org/bots/api#closeforumtopic
pub fn close_general_forum_topic(
client client: client.TelegramClient,
parameters parameters: types.CloseGeneralForumTopicParameters,
) -> Result(Bool, error.TelegaError)
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.
Official reference: https://core.telegram.org/bots/api#closegeneralforumtopic
pub fn convert_gift_to_stars(
client client: client.TelegramClient,
parameters parameters: types.ConvertGiftToStarsParameters,
) -> Result(Bool, error.TelegaError)
Converts a given regular gift to Telegram Stars. Requires the can_convert_gifts_to_stars business bot right. Returns True
on success.
Official reference: https://core.telegram.org/bots/api#convertgifttostars
pub fn copy_message(
client client: client.TelegramClient,
parameters parameters: types.CopyMessageParameters,
) -> Result(types.Message, error.TelegaError)
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.
Official reference: https://core.telegram.org/bots/api#copymessage
pub fn copy_messages(
client client: client.TelegramClient,
parameters parameters: types.CopyMessagesParameters,
) -> Result(types.Message, error.TelegaError)
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 forwardMessage, but the copied message doesn’t have a link to the original message. Returns the MessageId of the sent message on success.
Official reference: https://core.telegram.org/bots/api#copymessages
pub fn create_chat_invite_link(
client client: client.TelegramClient,
parameters parameters: types.CreateChatInviteLinkParameters,
) -> Result(types.ChatInviteLink, error.TelegaError)
Use this method to create an additional invite link for a chat. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. The link can be revoked using the method revokeChatInviteLink. Returns the new invite link as ChatInviteLink object.
Official reference: https://core.telegram.org/bots/api#createchatinvitelink
pub fn create_chat_subscription_invite_link(
client client: client.TelegramClient,
parameters parameters: types.CreateChatSubscriptionInviteLinkParameters,
) -> Result(types.ChatInviteLink, error.TelegaError)
Use this method to create a subscription invite link for a channel chat. The bot must have the can_invite_users
administrator rights. The link can be edited using the method editChatSubscriptionInviteLink or revoked using the method revokeChatInviteLink. Returns the new invite link as a ChatInviteLink object.
Official reference: https://core.telegram.org/bots/api#createchatsubscriptioninvitelink
pub fn create_forum_topic(
client client: client.TelegramClient,
parameters parameters: types.CreateForumTopicParameters,
) -> Result(types.ForumTopic, error.TelegaError)
Use this method to create a 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 information about the created topic as a ForumTopic object.
Official reference: https://core.telegram.org/bots/api#createforumtopic
pub fn create_invoice_link(
client client: client.TelegramClient,
parameters parameters: types.CreateInvoiceLinkParameters,
) -> Result(String, error.TelegaError)
Use this method to create a link for an invoice.
Official reference: https://core.telegram.org/bots/api#createinvoicelink
pub fn create_new_sticker_set(
client client: client.TelegramClient,
parameters parameters: types.CreateNewStickerSetParameters,
) -> Result(Bool, error.TelegaError)
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.
Official reference: https://core.telegram.org/bots/api#createnewstickerset
pub fn decline_chat_join_request(
client client: client.TelegramClient,
parameters parameters: types.DeclineChatJoinRequestParameters,
) -> Result(Bool, error.TelegaError)
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.
Official reference: https://core.telegram.org/bots/api#declinechatjoinrequest
pub fn delete_business_messages(
client client: client.TelegramClient,
parameters parameters: types.DeleteBusinessMessagesParameters,
) -> Result(Bool, error.TelegaError)
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.
Official reference: https://core.telegram.org/bots/api#deletebusinessmessages
pub fn delete_chat_photo(
client client: client.TelegramClient,
parameters parameters: types.DeleteChatPhotoParameters,
) -> Result(Bool, error.TelegaError)
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.
Official reference: https://core.telegram.org/bots/api#deletechatphoto
pub fn delete_chat_sticker_set(
client client: client.TelegramClient,
parameters parameters: types.DeleteChatStickerSetParameters,
) -> Result(Bool, error.TelegaError)
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.
Official reference: https://core.telegram.org/bots/api#deletechatstickerset
pub fn delete_forum_topic(
client client: client.TelegramClient,
parameters parameters: types.DeleteForumTopicParameters,
) -> Result(Bool, error.TelegaError)
Use this method to delete a forum topic along with all its messages in a forum 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.
Official reference: https://core.telegram.org/bots/api#deleteforumtopic
pub fn delete_message(
client client: client.TelegramClient,
parameters parameters: types.DeleteMessageParameters,
) -> Result(Bool, error.TelegaError)
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 permission in a supergroup or a channel, it can delete any message there. Returns True on success.
Official reference: https://core.telegram.org/bots/api#deletemessage
pub fn delete_messages(
client client: client.TelegramClient,
parameters parameters: types.DeleteMessagesParameters,
) -> Result(Bool, error.TelegaError)
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.
Official reference: https://core.telegram.org/bots/api#deletemessagessimultaneously
pub fn delete_my_commands(
client client: client.TelegramClient,
parameters parameters: option.Option(types.BotCommandParameters),
) -> Result(Bool, error.TelegaError)
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.
Official reference: https://core.telegram.org/bots/api#deletemycommands
pub fn delete_sticker_from_set(
client client: client.TelegramClient,
parameters parameters: types.DeleteStickerFromSetParameters,
) -> Result(Bool, error.TelegaError)
Use this method to delete a sticker from a set created by the bot. Returns True
on success.
Official reference: https://core.telegram.org/bots/api#deletestickerfromset
pub fn delete_sticker_set(
client client: client.TelegramClient,
parameters parameters: types.DeleteStickerSetParameters,
) -> Result(Bool, error.TelegaError)
Use this method to delete a sticker set that was created by the bot. Returns True
on success.
Official reference: https://core.telegram.org/bots/api#deletestickerset
pub fn delete_story(
client client: client.TelegramClient,
parameters parameters: types.DeleteStoryParameters,
) -> Result(Bool, error.TelegaError)
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.
Official reference: https://core.telegram.org/bots/api#deletestory
pub fn delete_webhook(
client client: client.TelegramClient,
) -> Result(Bool, error.TelegaError)
Use this method to remove webhook integration if you decide to switch back to getUpdates.
Official reference: https://core.telegram.org/bots/api#deletewebhook
pub fn delete_webhook_and_drop_updates(
client client: client.TelegramClient,
) -> Result(Bool, error.TelegaError)
The same as delete_webhook but also drops all pending updates.
pub fn edit_chat_invite_link(
client client: client.TelegramClient,
parameters parameters: types.EditChatInviteLinkParameters,
) -> Result(types.ChatInviteLink, error.TelegaError)
Use this method to edit a non-primary invite link created by the bot. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns the edited invite link as a ChatInviteLink object.
Official reference: https://core.telegram.org/bots/api#editchatinvitelink
pub fn edit_chat_subscription_invite_link(
client client: client.TelegramClient,
parameters parameters: types.EditChatSubscriptionInviteLinkParameters,
) -> Result(types.ChatInviteLink, error.TelegaError)
Use this method to edit a subscription invite link created by the bot. The bot must have the can_invite_users administrator rights. Returns the edited invite link as a ChatInviteLink object.
Official reference: https://core.telegram.org/bots/api#editchatsubscriptioninvitelink
pub fn edit_forum_topic(
client client: client.TelegramClient,
parameters parameters: types.EditForumTopicParameters,
) -> Result(Bool, error.TelegaError)
Use this method to edit name and icon of a 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.
Official reference: https://core.telegram.org/bots/api#editforumtopic
pub fn edit_general_forum_topic(
client client: client.TelegramClient,
parameters parameters: types.EditGeneralForumTopicParameters,
) -> Result(Bool, error.TelegaError)
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.
Official reference: https://core.telegram.org/bots/api#editgeneralforumtopic
pub fn edit_message_caption(
client client: client.TelegramClient,
parameters parameters: types.EditMessageCaptionParameters,
) -> Result(types.Message, error.TelegaError)
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.
Official reference: https://core.telegram.org/bots/api#editmessagecaption
pub fn edit_message_live_location(
client client: client.TelegramClient,
parameters parameters: types.EditMessageLiveLocationParameters,
) -> Result(types.Message, error.TelegaError)
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.
Official reference: https://core.telegram.org/bots/api#editmessagelivelocation
pub fn edit_message_media(
client client: client.TelegramClient,
parameters parameters: types.EditMessageMediaParameters,
) -> Result(types.Message, error.TelegaError)
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.
Official reference: https://core.telegram.org/bots/api#editmessagemedia
pub fn edit_message_reply_markup(
client client: client.TelegramClient,
parameters parameters: types.EditMessageReplyMarkupParameters,
) -> Result(types.Message, error.TelegaError)
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.
Official reference: https://core.telegram.org/bots/api#editmessagereplymarkup
pub fn edit_message_text(
client client: client.TelegramClient,
parameters parameters: types.EditMessageTextParameters,
) -> Result(types.Message, error.TelegaError)
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.
Official reference: https://core.telegram.org/bots/api#editmessagetext
pub fn edit_story(
client client: client.TelegramClient,
parameters parameters: types.EditStoryParameters,
) -> Result(types.Story, error.TelegaError)
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.
Official reference: https://core.telegram.org/bots/api#editstory
pub fn edit_user_star_subscription(
client client: client.TelegramClient,
parameters parameters: types.EditUserStarSubscriptionParameters,
) -> Result(Bool, error.TelegaError)
Allows the bot to cancel or re-enable extension of a subscription paid in Telegram Stars. Returns True
on success.
Official reference: https://core.telegram.org/bots/api#edituserstarsubscription
pub fn export_chat_invite_link(
client client: client.TelegramClient,
parameters parameters: types.ExportChatInviteLinkParameters,
) -> Result(String, error.TelegaError)
Use this method to generate a new primary invite link for a chat; any previously generated primary link is revoked. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns the new invite link as String on success.
Note: Each administrator in a chat generates their own invite links. Bots can’t use invite links generated by other administrators. If you want your bot to work with invite links, it will need to generate its own link using exportChatInviteLink or by calling the getChat method. If your bot needs to generate a new primary invite link replacing its previous one, use exportChatInviteLink again.
Official reference: https://core.telegram.org/bots/api#exportchatinvitelink
pub fn forward_message(
client client: client.TelegramClient,
parameters parameters: types.ForwardMessageParameters,
) -> Result(types.Message, error.TelegaError)
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.
Official reference: https://core.telegram.org/bots/api#forwardmessage
pub fn forward_messages(
client client: client.TelegramClient,
parameters parameters: types.ForwardMessagesParameters,
) -> Result(types.Message, error.TelegaError)
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.
Official reference: https://core.telegram.org/bots/api#forwardmessages
pub fn get_available_gifts(
client client: client.TelegramClient,
) -> Result(types.Gifts, error.TelegaError)
Returns the list of gifts that can be sent by the bot to users and channel chats. Requires no parameters. Returns a Gifts object.
Official reference: https://core.telegram.org/bots/api#getavailablegifts
pub fn get_business_account_gifts(
client client: client.TelegramClient,
parameters parameters: types.GetBusinessAccountGiftsParameters,
) -> Result(types.OwnedGifts, error.TelegaError)
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.
Official reference: https://core.telegram.org/bots/api#getbusinessaccountgifts
pub fn get_business_account_star_balance(
client client: client.TelegramClient,
parameters parameters: types.GetBusinessAccountStarBalanceParameters,
) -> Result(types.StarAmount, error.TelegaError)
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.
Official reference: https://core.telegram.org/bots/api#getbusinessaccountstarbalance
pub fn get_business_connection(
client client: client.TelegramClient,
parameters parameters: types.GetBusinessConnectionParameters,
) -> Result(types.BusinessConnection, error.TelegaError)
Use this method to get information about the connection of the bot with a business account. Returns a BusinessConnection object on success.
Official reference: https://core.telegram.org/bots/api#getbusinessconnection
pub fn get_chat(
client client: client.TelegramClient,
chat_id chat_id: String,
) -> Result(types.ChatFullInfo, error.TelegaError)
Use this method to get up-to-date information about the chat. Returns a ChatFullInfo object on success.
Official reference: https://core.telegram.org/bots/api#getchat
pub fn get_chat_administrators(
client client: client.TelegramClient,
parameters parameters: types.GetChatAdministratorsParameters,
) -> Result(List(types.ChatMember), error.TelegaError)
Use this method to get a list of administrators in a chat, which aren’t bots. Returns an Array of ChatMember objects.
Official reference: https://core.telegram.org/bots/api#getchatadministrators
pub fn get_chat_member(
client client: client.TelegramClient,
parameters parameters: types.GetChatMemberParameters,
) -> Result(types.ChatMember, error.TelegaError)
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.
Official reference: https://core.telegram.org/bots/api#getchatmember
pub fn get_chat_member_count(
client client: client.TelegramClient,
parameters parameters: types.GetChatMemberCountParameters,
) -> Result(Int, error.TelegaError)
Use this method to get the number of members in a chat. Returns Int
on success.
Official reference: https://core.telegram.org/bots/api#getchatmembercount
pub fn get_chat_menu_button(
client client: client.TelegramClient,
parameters parameters: types.GetChatMenuButtonParameters,
) -> Result(types.MenuButton, error.TelegaError)
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.
Official reference: https://core.telegram.org/bots/api#getchatmenubutton
pub fn get_custom_emoji_stickers(
client client: client.TelegramClient,
parameters parameters: types.GetCustomEmojiStickersParameters,
) -> Result(types.Sticker, error.TelegaError)
Use this method to get information about custom emoji stickers by their identifiers. Returns an Array of Sticker objects.
Official reference: https://core.telegram.org/bots/api#getcustomemojistickers
pub fn get_file(
client client: client.TelegramClient,
file_id file_id: String,
) -> Result(types.File, error.TelegaError)
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.
Official reference: https://core.telegram.org/bots/api#getfile
pub fn get_forum_topic_icon_stickers(
client client: client.TelegramClient,
) -> Result(List(types.Sticker), error.TelegaError)
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.
Official reference: https://core.telegram.org/bots/api#getforumtopiciconstickers
pub fn get_game_high_scores(
client client: client.TelegramClient,
parameters parameters: types.GetGameHighScoresParameters,
) -> Result(types.GameHighScore, error.TelegaError)
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.
This method will currently return scores for the target user, plus two of their closest neighbors on each side. Will also return the top three users if the user and their neighbors are not among them. Please note that this behavior is subject to change.
Official reference: https://core.telegram.org/bots/api#getgamehighscores
pub fn get_me(
client client: client.TelegramClient,
) -> Result(types.User, error.TelegaError)
A simple method for testing your bot’s authentication token.
Official reference: https://core.telegram.org/bots/api#getme
pub fn get_my_commands(
client client: client.TelegramClient,
parameters parameters: option.Option(types.BotCommandParameters),
) -> Result(types.BotCommand, error.TelegaError)
Use this method to get the current list of the bot’s commands for the given scope and user language.
Official reference: https://core.telegram.org/bots/api#getmycommands
pub fn get_my_default_administrator_rights(
client client: client.TelegramClient,
parameters parameters: types.GetMyDefaultAdministratorRightsParameters,
) -> Result(types.ChatAdministratorRights, error.TelegaError)
Use this method to get the current default administrator rights of the bot. Returns ChatAdministratorRights on success.
Official reference: https://core.telegram.org/bots/api#getmydefaultadministratorrights
pub fn get_my_description(
client client: client.TelegramClient,
parameters parameters: types.GetMyDescriptionParameters,
) -> Result(types.BotDescription, error.TelegaError)
Use this method to get the current bot description for the given user language. Returns BotDescription on success.
Official reference: https://core.telegram.org/bots/api#getmydescription
pub fn get_my_name(
client client: client.TelegramClient,
parameters parameters: types.GetMyNameParameters,
) -> Result(types.BotName, error.TelegaError)
Use this method to get the current bot name for the given user language. Returns BotName on success.
Official reference: https://core.telegram.org/bots/api#getmyname
pub fn get_my_short_description(
client client: client.TelegramClient,
parameters parameters: types.GetMyShortDescriptionParameters,
) -> Result(types.BotShortDescription, error.TelegaError)
Use this method to get the current bot short description for the given user language. Returns BotShortDescription on success.
Official reference: https://core.telegram.org/bots/api#getmyshortdescription
pub fn get_star_transactions(
client client: client.TelegramClient,
parameters parameters: types.GetStarTransactionsParameters,
) -> Result(types.StarTransactions, error.TelegaError)
Returns the bot’s Telegram Star transactions in chronological order. On success, returns a StarTransactions object.
Official reference: https://core.telegram.org/bots/api#getmystartransactions
pub fn get_sticker_set(
client client: client.TelegramClient,
parameters parameters: types.GetStickerSetParameters,
) -> Result(types.StickerSet, error.TelegaError)
Use this method to get a sticker set. On success, a StickerSet object is returned.
Official reference: https://core.telegram.org/bots/api#getstickerset
pub fn get_updates(
client client: client.TelegramClient,
parameters parameters: option.Option(types.GetUpdatesParameters),
) -> Result(List(types.Update), error.TelegaError)
Use this method to receive incoming updates using long polling (wiki).
Notes
- This method will not work if an outgoing webhook is set up.
- In order to avoid getting duplicate updates, recalculate offset after each server response.
Official reference: https://core.telegram.org/bots/api#getupdates
pub fn get_user_chat_boosts(
client client: client.TelegramClient,
parameters parameters: types.GetUserChatBoostsParameters,
) -> Result(types.UserChatBoosts, error.TelegaError)
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.
Official reference: https://core.telegram.org/bots/api#getuserchatboosts
pub fn get_user_profile_photos(
client client: client.TelegramClient,
parameters parameters: types.GetUserProfilePhotosParameters,
) -> Result(types.UserProfilePhotos, error.TelegaError)
Use this method to get a list of profile pictures for a user. Returns a UserProfilePhotos object.
Official reference: https://core.telegram.org/bots/api#getuserprofilephotos
pub fn get_webhook_info(
client client: client.TelegramClient,
) -> Result(types.WebhookInfo, error.TelegaError)
Use this method to get current webhook status.
Official reference: https://core.telegram.org/bots/api#getwebhookinfo
pub fn gift_premium(
client client: client.TelegramClient,
parameters parameters: types.GiftPremiumSubscriptionParameters,
) -> Result(Bool, error.TelegaError)
Gifts a Telegram Premium subscription to the given user. Returns True
on success.
Official reference: https://core.telegram.org/bots/api#giftpremium
pub fn hide_general_forum_topic(
client client: client.TelegramClient,
parameters parameters: types.HideGeneralForumTopicParameters,
) -> Result(Bool, error.TelegaError)
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.
Official reference: https://core.telegram.org/bots/api#hidegeneralforumtopic
pub fn leave_chat(
client client: client.TelegramClient,
parameters parameters: types.LeaveChatParameters,
) -> Result(Bool, error.TelegaError)
Use this method for your bot to leave a group, supergroup or channel. Returns True
on success.
Official reference: https://core.telegram.org/bots/api#leavechat
pub fn log_out(
client client: client.TelegramClient,
) -> Result(Bool, error.TelegaError)
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.
Official reference: https://core.telegram.org/bots/api#logout
pub fn pin_chat_message(
client client: client.TelegramClient,
parameters parameters: types.PinChatMessageParameters,
) -> Result(Bool, error.TelegaError)
Use this method to add a message to the list of pinned messages in a chat. If the chat is not a private chat, the bot must be an administrator in the chat for this to work and must have the ‘can_pin_messages’ administrator right in a supergroup or ‘can_edit_messages’ administrator right in a channel. Returns True
on success.
Official reference: https://core.telegram.org/bots/api#pinchatmessage
pub fn post_business_story(
client client: client.TelegramClient,
parameters parameters: types.PostStoryParameters,
) -> Result(types.Story, error.TelegaError)
Posts a story on behalf of a managed business account. Requires the can_manage_stories business bot right. Returns Story on success.
Official reference: https://core.telegram.org/bots/api#poststory
pub fn promote_chat_member(
client client: client.TelegramClient,
parameters parameters: types.PromoteChatMemberParameters,
) -> Result(Bool, error.TelegaError)
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.
Official reference: https://core.telegram.org/bots/api#promotechatmember
pub fn read_business_message(
client client: client.TelegramClient,
parameters parameters: types.ReadBusinessMessageParameters,
) -> Result(Bool, error.TelegaError)
Marks incoming message as read on behalf of a business account. Requires the can_read_messages business bot right. Returns True
on success.
Official reference: https://core.telegram.org/bots/api#readbusinessmessage
pub fn refund_star_payment(
client client: client.TelegramClient,
parameters parameters: types.RefundStarPaymentParameters,
) -> Result(Bool, error.TelegaError)
Refunds a successful payment in Telegram Stars. Returns True
on success.
Official reference: https://core.telegram.org/bots/api#refundstars
pub fn remove_business_account_profile_photo(
client client: client.TelegramClient,
parameters parameters: types.RemoveBusinessAccountProfilePhotoParameters,
) -> Result(Bool, error.TelegaError)
Removes the current profile photo of a managed business account. Requires the can_edit_profile_photo business bot right. Returns True
on success.
Official reference: https://core.telegram.org/bots/api#removebusinessaccountprofilephoto
pub fn remove_chat_verification(
client client: client.TelegramClient,
parameters parameters: types.RemoveChatVerificationParameters,
) -> Result(Bool, error.TelegaError)
Removes verification from a chat that is currently verified on behalf of the organization represented by the bot. Returns True
on success.
Official reference: https://core.telegram.org/bots/api#removechatverification
pub fn remove_user_verification(
client client: client.TelegramClient,
parameters parameters: types.RemoveUserVerificationParameters,
) -> Result(Bool, error.TelegaError)
Removes verification from a user who is currently verified on behalf of the organization represented by the bot. Returns True
on success.
Official reference: https://core.telegram.org/bots/api#removeuserverification
pub fn reopen_forum_topic(
client client: client.TelegramClient,
parameters parameters: types.ReopenForumTopicParameters,
) -> Result(Bool, error.TelegaError)
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.
Official reference: https://core.telegram.org/bots/api#reopenforumtopic
pub fn reopen_general_forum_topic(
client client: client.TelegramClient,
parameters parameters: types.ReopenGeneralForumTopicParameters,
) -> Result(Bool, error.TelegaError)
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.
Official reference: https://core.telegram.org/bots/api#reopengeneralforumtopic
pub fn replace_sticker_in_set(
client client: client.TelegramClient,
parameters parameters: types.ReplaceStickerInSetParameters,
) -> Result(Bool, error.TelegaError)
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.
Official reference: https://core.telegram.org/bots/api#replacestickerinset
pub fn restrict_chat_member(
client client: client.TelegramClient,
parameters parameters: types.RestrictChatMemberParameters,
) -> Result(Bool, error.TelegaError)
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.
Official reference: https://core.telegram.org/bots/api#restrictchatmember
pub fn revoke_chat_invite_link(
client client: client.TelegramClient,
parameters parameters: types.RevokeChatInviteLinkParameters,
) -> Result(types.ChatInviteLink, error.TelegaError)
Use this method to revoke an invite link created by the bot. If the primary link is revoked, a new link is automatically generated. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns the revoked invite link as ChatInviteLink object.
Official reference: https://core.telegram.org/bots/api#revokechatinvitelink
pub fn send_animation(
client client: client.TelegramClient,
parameters parameters: types.SendAnimationParameters,
) -> Result(types.Message, error.TelegaError)
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.
Official reference: https://core.telegram.org/bots/api#sendanimation
pub fn send_audio(
client client: client.TelegramClient,
parameters parameters: types.SendAudioParameters,
) -> Result(response.Response(String), error.TelegaError)
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.
Official reference: https://core.telegram.org/bots/api#sendaudio
pub fn send_chat_action(
client client: client.TelegramClient,
parameters parameters: types.SendChatActionParameters,
) -> Result(types.Message, error.TelegaError)
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.
Example: The ImageBot needs some time to process a request and upload the image. Instead of sending a text message along the lines of “Retrieving image, please wait…”, the bot may use sendChatAction with action = upload_photo. The user will see a “sending photo” status for the bot.
We only recommend using this method when a response from the bot will take a noticeable amount of time to arrive.
Official reference: https://core.telegram.org/bots/api#sendchataction
pub fn send_contact(
client client: client.TelegramClient,
parameters parameters: types.SendContactParameters,
) -> Result(types.Message, error.TelegaError)
Use this method to send phone contacts. On success, the sent Message is returned.
Official reference: https://core.telegram.org/bots/api#sendcontact
pub fn send_dice(
client client: client.TelegramClient,
parameters parameters: types.SendDiceParameters,
) -> Result(types.Message, error.TelegaError)
Use this method to send an animated emoji that will display a random value.
Official reference: https://core.telegram.org/bots/api#senddice
pub fn send_document(
client client: client.TelegramClient,
parameters parameters: types.SendDocumentParameters,
) -> Result(types.Message, error.TelegaError)
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.
Official reference: https://core.telegram.org/bots/api#senddocument
pub fn send_game(
client client: client.TelegramClient,
parameters parameters: types.SendGameParameters,
) -> Result(types.Message, error.TelegaError)
Use this method to send a game. On success, the sent Message is returned.
Official reference: https://core.telegram.org/bots/api#sendgame
pub fn send_gift(
client client: client.TelegramClient,
parameters parameters: types.SendGiftParameters,
) -> Result(Bool, error.TelegaError)
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.
Official reference: https://core.telegram.org/bots/api#sendgift
pub fn send_invoice(
client client: client.TelegramClient,
parameters parameters: types.SendInvoiceParameters,
) -> Result(types.Message, error.TelegaError)
Use this method to send invoices. On success, the sent Message is returned.
Official reference: https://core.telegram.org/bots/api#sendinvoice
pub fn send_location(
client client: client.TelegramClient,
parameters parameters: types.SendLocationParameters,
) -> Result(types.Message, error.TelegaError)
Use this method to send point on the map. On success, the sent Message is returned.
Official reference: https://core.telegram.org/bots/api#sendlocation
pub fn send_media_group(
client client: client.TelegramClient,
parameters parameters: types.SendMediaGroupParameters,
) -> Result(types.Message, error.TelegaError)
Use this method to send a group of photos, videos, documents or audio files as an album. Documents and audio files can be only grouped in an album with the first item having a filename. On success, the sent Message is returned.
Official reference: https://core.telegram.org/bots/api#sendmediagroup
pub fn send_message(
client client: client.TelegramClient,
parameters parameters: types.SendMessageParameters,
) -> Result(types.Message, error.TelegaError)
Use this method to send text messages with additional parameters.
Official reference: https://core.telegram.org/bots/api#sendmessage
pub fn send_photo(
client client: client.TelegramClient,
parameters parameters: types.SendPhotoParameters,
) -> Result(types.Message, error.TelegaError)
Use this method to send photos. On success, the sent Message is returned.
Official reference: https://core.telegram.org/bots/api#sendphoto
pub fn send_poll(
client client: client.TelegramClient,
parameters parameters: types.SendPollParameters,
) -> Result(types.Message, error.TelegaError)
Use this method to send a native poll. On success, the sent Message is returned.
Official reference: https://core.telegram.org/bots/api#sendpoll
pub fn send_sticker(
client client: client.TelegramClient,
parameters parameters: types.SendStickerParameters,
) -> Result(types.Message, error.TelegaError)
pub fn send_venue(
client client: client.TelegramClient,
parameters parameters: types.SendVenueParameters,
) -> Result(types.Message, error.TelegaError)
Use this method to send information about a venue. On success, the sent Message is returned.
Official reference: https://core.telegram.org/bots/api#sendvenue
pub fn send_video(
client client: client.TelegramClient,
parameters parameters: types.SendVideoParameters,
) -> Result(types.Message, error.TelegaError)
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.
Official reference: https://core.telegram.org/bots/api#sendvideo
pub fn send_video_note(
client client: client.TelegramClient,
parameters parameters: types.SendVideoNoteParameters,
) -> Result(types.Message, error.TelegaError)
Use this method to send video messages. On success, the sent Message is returned.
Official reference: https://core.telegram.org/bots/api#sendvideonote
pub fn send_voice(
client client: client.TelegramClient,
parameters parameters: types.SendVoiceParameters,
) -> Result(types.Message, error.TelegaError)
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 (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.
Official reference: https://core.telegram.org/bots/api#sendvoice
pub fn set_business_account_bio(
client client: client.TelegramClient,
parameters parameters: types.SetBusinessAccountBioParameters,
) -> Result(Bool, error.TelegaError)
Changes the bio of a managed business account. Requires the can_change_bio business bot right. Returns True
on success.
Official reference: https://core.telegram.org/bots/api#setbusinessaccountbio
pub fn set_business_account_gift_settings(
client client: client.TelegramClient,
parameters parameters: types.SetBusinessAccountGiftSettingsParameters,
) -> Result(Bool, error.TelegaError)
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.
Official reference: https://core.telegram.org/bots/api#setbusinessaccountgiftsettings
pub fn set_business_account_name(
client client: client.TelegramClient,
parameters parameters: types.SetBusinessAccountNameParameters,
) -> Result(Bool, error.TelegaError)
Changes the first and last name of a managed business account. Requires the can_change_name business bot right. Returns True
on success.
Official reference: https://core.telegram.org/bots/api#setbusinessaccountname
pub fn set_business_account_profile_photo(
client client: client.TelegramClient,
parameters parameters: types.SetBusinessAccountProfilePhotoParameters,
) -> Result(Bool, error.TelegaError)
Changes the profile photo of a managed business account. Requires the can_edit_profile_photo business bot right. Returns True
on success.
Official reference: https://core.telegram.org/bots/api#setbusinessaccountprofilephoto
pub fn set_business_account_username(
client client: client.TelegramClient,
parameters parameters: types.SetBusinessAccountUsernameParameters,
) -> Result(Bool, error.TelegaError)
Changes the username of a managed business account. Requires the can_change_username business bot right. Returns True
on success.
Official reference: https://core.telegram.org/bots/api#setbusinessaccountusername
pub fn set_chat_administrator_custom_title(
client client: client.TelegramClient,
parameters parameters: types.SetChatAdministratorCustomTitleParameters,
) -> Result(Bool, error.TelegaError)
Use this method to set a custom title for an administrator in a supergroup promoted by the bot. Returns True
on success.
Official reference: https://core.telegram.org/bots/api#setchatadministratorcustomtitle
pub fn set_chat_description(
client client: client.TelegramClient,
parameters parameters: types.SetChatDescriptionParameters,
) -> Result(Bool, error.TelegaError)
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.
Official reference: https://core.telegram.org/bots/api#setchatdescription
pub fn set_chat_menu_button(
client client: client.TelegramClient,
parameters parameters: types.SetChatMenuButtonParameters,
) -> Result(Bool, error.TelegaError)
Use this method to change the bot’s menu button in a private chat, or the default menu button. Returns True
on success.
Official reference: https://core.telegram.org/bots/api#setchatmenubutton
pub fn set_chat_permissions(
client client: client.TelegramClient,
parameters parameters: types.SetChatPermissionsParameters,
) -> Result(Bool, error.TelegaError)
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.
Official reference: https://core.telegram.org/bots/api#setchatpermissions
pub fn set_chat_photo(
client client: client.TelegramClient,
parameters parameters: types.SetChatPhotoParameters,
) -> Result(Bool, error.TelegaError)
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.
Official reference: https://core.telegram.org/bots/api#setchatphoto
pub fn set_chat_sticker_set(
client client: client.TelegramClient,
parameters parameters: types.SetChatStickerSetParameters,
) -> Result(Bool, error.TelegaError)
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.
Official reference: https://core.telegram.org/bots/api#setchatstickerset
pub fn set_chat_title(
client client: client.TelegramClient,
parameters parameters: types.SetChatTitleParameters,
) -> Result(Bool, error.TelegaError)
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.
Official reference: https://core.telegram.org/bots/api#setchattitle
pub fn set_custom_emoji_sticker_set_thumbnail(
client client: client.TelegramClient,
parameters parameters: types.SetCustomEmojiStickerSetThumbnailParameters,
) -> Result(Bool, error.TelegaError)
Use this method to set the thumbnail of a custom emoji sticker set. Returns True
on success.
Official reference: https://core.telegram.org/bots/api#setcustomemojistickersetthumbnail
pub fn set_game_score(
client client: client.TelegramClient,
parameters parameters: types.SetGameScoreParameters,
) -> Result(types.Message, error.TelegaError)
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
.
Official reference: https://core.telegram.org/bots/api#setgamescore
pub fn set_message_reaction(
client client: client.TelegramClient,
parameters parameters: types.SetMessageReactionParameters,
) -> Result(Bool, error.TelegaError)
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.
Official reference: https://core.telegram.org/bots/api#setmessagereaction
pub fn set_my_commands(
client client: client.TelegramClient,
commands commands: List(types.BotCommand),
parameters parameters: option.Option(types.BotCommandParameters),
) -> Result(Bool, error.TelegaError)
Use this method to change the list of the bot’s commands. See commands documentation for more details about bot commands.
Official reference: https://core.telegram.org/bots/api#setmycommands
pub fn set_my_default_administrator_rights(
client client: client.TelegramClient,
parameters parameters: types.SetMyDefaultAdministratorRightsParameters,
) -> Result(Bool, error.TelegaError)
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.
Official reference: https://core.telegram.org/bots/api#setmydefaultadministratorrights
pub fn set_my_description(
client client: client.TelegramClient,
parameters parameters: types.SetMyDescriptionParameters,
) -> Result(Bool, error.TelegaError)
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.
Official reference: https://core.telegram.org/bots/api#setmydescription
pub fn set_my_name(
client client: client.TelegramClient,
parameters parameters: types.SetMyNameParameters,
) -> Result(Bool, error.TelegaError)
Use this method to change the bot’s name. Returns True
on success.
Official reference: https://core.telegram.org/bots/api#setmyname
pub fn set_my_short_description(
client client: client.TelegramClient,
parameters parameters: types.SetMyShortDescriptionParameters,
) -> Result(Bool, error.TelegaError)
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.
Official reference: https://core.telegram.org/bots/api#setmyshortdescription
pub fn set_sticker_emoji_list(
client client: client.TelegramClient,
parameters parameters: types.SetStickerEmojiListParameters,
) -> Result(Bool, error.TelegaError)
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.
Official reference: https://core.telegram.org/bots/api#setstickeremojilist
pub fn set_sticker_keywords(
client client: client.TelegramClient,
parameters parameters: types.SetStickerKeywordsParameters,
) -> Result(Bool, error.TelegaError)
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.
Official reference: https://core.telegram.org/bots/api#setstickerkeywords
pub fn set_sticker_mask_position(
client client: client.TelegramClient,
parameters parameters: types.SetStickerMaskPositionParameters,
) -> Result(Bool, error.TelegaError)
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.
Official reference: https://core.telegram.org/bots/api#setstickermaskposition
pub fn set_sticker_position_in_set(
client client: client.TelegramClient,
parameters parameters: types.SetStickerPositionInSetParameters,
) -> Result(Bool, error.TelegaError)
Use this method to move a sticker in a set to a specific position. Returns True
on success.
Official reference: https://core.telegram.org/bots/api#setstickerpositioninset
pub fn set_sticker_set_thumbnail(
client client: client.TelegramClient,
parameters parameters: types.SetStickerSetThumbnailParameters,
) -> Result(Bool, error.TelegaError)
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.
Official reference: https://core.telegram.org/bots/api#setstickersetthumbnail
pub fn set_sticker_set_title(
client client: client.TelegramClient,
parameters parameters: types.SetStickerSetTitleParameters,
) -> Result(Bool, error.TelegaError)
Use this method to set the title of a created sticker set. Returns True
on success.
Official reference: https://core.telegram.org/bots/api#setstickersettitle
pub fn set_webhook(
client client: client.TelegramClient,
parameters parameters: types.SetWebhookParameters,
) -> Result(Bool, error.TelegaError)
Set the webhook URL using setWebhook API.
Official reference: https://core.telegram.org/bots/api#setwebhook
pub fn stop_message_live_location(
client client: client.TelegramClient,
parameters parameters: types.StopMessageLiveLocationParameters,
) -> Result(types.Message, error.TelegaError)
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.
Official reference: https://core.telegram.org/bots/api#stopmessagelivelocation
pub fn stop_poll(
client client: client.TelegramClient,
parameters parameters: types.StopPollParameters,
) -> Result(types.Poll, error.TelegaError)
Use this method to stop a poll which was sent by the bot. On success, the stopped Poll is returned.
Official reference: https://core.telegram.org/bots/api#stoppoll
pub fn transfer_business_account_stars(
client client: client.TelegramClient,
parameters parameters: types.TransferBusinessAccountStarsParameters,
) -> Result(Bool, error.TelegaError)
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.
Official reference: https://core.telegram.org/bots/api#transferbusinessaccountstars
pub fn transfer_gift(
client client: client.TelegramClient,
parameters parameters: types.TransferGiftParameters,
) -> Result(Bool, error.TelegaError)
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.
Official reference: https://core.telegram.org/bots/api#transfergift
pub fn unban_chat_member(
client client: client.TelegramClient,
parameters parameters: types.UnbanChatMemberParameters,
) -> Result(Bool, error.TelegaError)
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.
Official reference: https://core.telegram.org/bots/api#unbanchatmember
pub fn unban_chat_sender_chat(
client client: client.TelegramClient,
parameters parameters: types.UnbanChatSenderChatParameters,
) -> Result(Bool, error.TelegaError)
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.
Official reference: https://core.telegram.org/bots/api#unbanchatsenderchat
pub fn unhide_general_forum_topic(
client client: client.TelegramClient,
parameters parameters: types.UnhideGeneralForumTopicParameters,
) -> Result(Bool, error.TelegaError)
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.
Official reference: https://core.telegram.org/bots/api#unhidegeneralforumtopic
pub fn unpin_all_chat_messages(
client client: client.TelegramClient,
parameters parameters: types.UnpinAllChatMessagesParameters,
) -> Result(Bool, error.TelegaError)
Use this method to clear the list of pinned messages in a chat. If the chat is not a private chat, the bot must be an administrator in the chat for this to work and must have the ‘can_pin_messages’ administrator right in a supergroup or ‘can_edit_messages’ administrator right in a channel. Returns True
on success.
Official reference: https://core.telegram.org/bots/api#clearchatpinnedmessages
pub fn unpin_all_forum_topic_pinned_messages(
client client: client.TelegramClient,
parameters parameters: types.UnpinAllForumTopicMessagesParameters,
) -> Result(Bool, error.TelegaError)
Use this method to clear the list of pinned messages in a 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.
Official reference: https://core.telegram.org/bots/api#unpinallforumtopicpinnedmessages
pub fn unpin_all_general_forum_topic_messages(
client client: client.TelegramClient,
parameters parameters: types.UnpinAllGeneralForumTopicPinnedMessagesParameters,
) -> Result(Bool, error.TelegaError)
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.
Official reference: https://core.telegram.org/bots/api#unpinallgeneralforumtopicmessages
pub fn unpin_chat_message(
client client: client.TelegramClient,
parameters parameters: types.UnpinChatMessageParameters,
) -> Result(Bool, error.TelegaError)
Use this method to remove a message from the list of pinned messages in a chat. If the chat is not a private chat, the bot must be an administrator in the chat for this to work and must have the ‘can_pin_messages’ administrator right in a supergroup or ‘can_edit_messages’ administrator right in a channel. Returns True
on success.
Official reference: https://core.telegram.org/bots/api#unpinchatmessage
pub fn upgrade_gift(
client client: client.TelegramClient,
parameters parameters: types.UpgradeGiftParameters,
) -> Result(Bool, error.TelegaError)
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.
Official reference: https://core.telegram.org/bots/api#upgradegift
pub fn upload_sticker_file(
client client: client.TelegramClient,
parameters parameters: types.UploadStickerFileParameters,
) -> Result(types.File, error.TelegaError)
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.
Official reference: https://core.telegram.org/bots/api#uploadstickerfile
pub fn verify_chat(
client client: client.TelegramClient,
parameters parameters: types.VerifyChatParameters,
) -> Result(Bool, error.TelegaError)
Verifies a chat on behalf of the organization which is represented by the bot. Returns True
on success.
Official reference: https://core.telegram.org/bots/api#verifychat
pub fn verify_user(
client client: client.TelegramClient,
parameters parameters: types.VerifyUserParameters,
) -> Result(Bool, error.TelegaError)
Verifies a user on behalf of the organization which is represented by the bot. Returns True
on success.
Official reference: https://core.telegram.org/bots/api#verifyuser