1
0
mirror of https://github.com/eternnoir/pyTelegramBotAPI.git synced 2023-08-10 21:12:57 +03:00

Update docstrings

This commit is contained in:
coder2020official 2022-03-06 23:14:07 +05:00
parent 3c7d3c0196
commit 78bdf1ca4e

View File

@ -340,6 +340,8 @@ class TeleBot:
In case of an unsuccessful request, we will give up after a reasonable amount of attempts. In case of an unsuccessful request, we will give up after a reasonable amount of attempts.
Returns True on success. Returns True on success.
Telegram documentation: https://core.telegram.org/bots/api#setwebhook
:param url: HTTPS url to send updates to. Use an empty string to remove webhook integration :param url: HTTPS url to send updates to. Use an empty string to remove webhook integration
:param certificate: Upload your public key certificate so that the root certificate in use can be checked. :param certificate: Upload your public key certificate so that the root certificate in use can be checked.
See our self-signed guide for details. See our self-signed guide for details.
@ -355,7 +357,7 @@ class TeleBot:
resolved through DNS resolved through DNS
:param drop_pending_updates: Pass True to drop all pending updates :param drop_pending_updates: Pass True to drop all pending updates
:param timeout: Integer. Request connection timeout :param timeout: Integer. Request connection timeout
:return: :return: API reply.
""" """
return apihelper.set_webhook(self.token, url, certificate, max_connections, allowed_updates, ip_address, return apihelper.set_webhook(self.token, url, certificate, max_connections, allowed_updates, ip_address,
drop_pending_updates, timeout) drop_pending_updates, timeout)
@ -364,6 +366,8 @@ class TeleBot:
""" """
Use this method to remove webhook integration if you decide to switch back to getUpdates. Use this method to remove webhook integration if you decide to switch back to getUpdates.
Telegram documentation: https://core.telegram.org/bots/api#deletewebhook
:param drop_pending_updates: Pass True to drop all pending updates :param drop_pending_updates: Pass True to drop all pending updates
:param timeout: Integer. Request connection timeout :param timeout: Integer. Request connection timeout
:return: bool :return: bool
@ -375,6 +379,8 @@ class TeleBot:
Use this method to get current webhook status. Requires no parameters. Use this method to get current webhook status. Requires no parameters.
If the bot is using getUpdates, will return an object with the url field empty. If the bot is using getUpdates, will return an object with the url field empty.
Telegram documentation: https://core.telegram.org/bots/api#getwebhookinfo
:param timeout: Integer. Request connection timeout :param timeout: Integer. Request connection timeout
:return: On success, returns a WebhookInfo object. :return: On success, returns a WebhookInfo object.
""" """
@ -390,6 +396,8 @@ class TeleBot:
""" """
Use this method to receive incoming updates using long polling (wiki). An Array of Update objects is returned. Use this method to receive incoming updates using long polling (wiki). An Array of Update objects is returned.
Telegram documentation: https://core.telegram.org/bots/api#getupdates
:param allowed_updates: Array of string. List the types of updates you want your bot to receive. :param allowed_updates: Array of string. List the types of updates you want your bot to receive.
:param offset: Integer. Identifier of the first update to be returned. :param offset: Integer. Identifier of the first update to be returned.
:param limit: Integer. Limits the number of updates to be retrieved. :param limit: Integer. Limits the number of updates to be retrieved.
@ -827,6 +835,8 @@ class TeleBot:
def get_me(self) -> types.User: def get_me(self) -> types.User:
""" """
Returns basic information about the bot in form of a User object. Returns basic information about the bot in form of a User object.
Telegram documentation: https://core.telegram.org/bots/api#getme
""" """
result = apihelper.get_me(self.token) result = apihelper.get_me(self.token)
return types.User.de_json(result) return types.User.de_json(result)
@ -839,6 +849,8 @@ class TeleBot:
It is guaranteed that the link will be valid for at least 1 hour. 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 get_file again. When the link expires, a new one can be requested by calling get_file again.
Telegram documentation: https://core.telegram.org/bots/api#getfile
:param file_id: File identifier :param file_id: File identifier
""" """
return types.File.de_json(apihelper.get_file(self.token, file_id)) return types.File.de_json(apihelper.get_file(self.token, file_id))
@ -862,6 +874,8 @@ class TeleBot:
After a successful call, you can immediately log in on a local server, 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. but will not be able to log in back to the cloud Bot API server for 10 minutes.
Returns True on success. Returns True on success.
Telegram documentation: https://core.telegram.org/bots/api#logout
""" """
return apihelper.log_out(self.token) return apihelper.log_out(self.token)
@ -872,6 +886,8 @@ class TeleBot:
after server restart. after server restart.
The method will return error 429 in the first 10 minutes after the bot is launched. The method will return error 429 in the first 10 minutes after the bot is launched.
Returns True on success. Returns True on success.
Telegram documentation: https://core.telegram.org/bots/api#close
""" """
return apihelper.close(self.token) return apihelper.close(self.token)
@ -879,7 +895,8 @@ class TeleBot:
limit: Optional[int]=None) -> types.UserProfilePhotos: limit: Optional[int]=None) -> types.UserProfilePhotos:
""" """
Retrieves the user profile photos of the person with 'user_id' Retrieves the user profile photos of the person with 'user_id'
See https://core.telegram.org/bots/api#getuserprofilephotos
Telegram documentation: https://core.telegram.org/bots/api#getuserprofilephotos
:param user_id: Integer - Unique identifier of the target user :param user_id: Integer - Unique identifier of the target user
:param offset: :param offset:
@ -894,8 +911,10 @@ class TeleBot:
Use this method to get up to date information about the chat (current name of the user for one-on-one Use this method to get up to date information about the chat (current name of the user for one-on-one
conversations, current username of a user, group or channel, etc.). Returns a Chat object on success. conversations, current username of a user, group or channel, etc.). Returns a Chat object on success.
Telegram documentation: https://core.telegram.org/bots/api#getchat
:param chat_id: :param chat_id:
:return: :return: API reply.
""" """
result = apihelper.get_chat(self.token, chat_id) result = apihelper.get_chat(self.token, chat_id)
return types.Chat.de_json(result) return types.Chat.de_json(result)
@ -904,8 +923,10 @@ class TeleBot:
""" """
Use this method for your bot to leave a group, supergroup or channel. Returns True on success. Use this method for your bot to leave a group, supergroup or channel. Returns True on success.
Telegram documentation: https://core.telegram.org/bots/api#leavechat
:param chat_id: :param chat_id:
:return: :return: API reply.
""" """
result = apihelper.leave_chat(self.token, chat_id) result = apihelper.leave_chat(self.token, chat_id)
return result return result
@ -916,9 +937,11 @@ class TeleBot:
On success, returns an Array of ChatMember objects that contains On success, returns an Array of ChatMember objects that contains
information about all chat administrators except other bots. information about all chat administrators except other bots.
Telegram documentation: https://core.telegram.org/bots/api#getchatadministrators
:param chat_id: Unique identifier for the target chat or username :param chat_id: Unique identifier for the target chat or username
of the target supergroup or channel (in the format @channelusername) of the target supergroup or channel (in the format @channelusername)
:return: :return: API reply.
""" """
result = apihelper.get_chat_administrators(self.token, chat_id) result = apihelper.get_chat_administrators(self.token, chat_id)
return [types.ChatMember.de_json(r) for r in result] return [types.ChatMember.de_json(r) for r in result]
@ -935,8 +958,10 @@ class TeleBot:
""" """
Use this method to get the number of members in a chat. Returns Int on success. Use this method to get the number of members in a chat. Returns Int on success.
Telegram documentation: https://core.telegram.org/bots/api#getchatmembercount
:param chat_id: :param chat_id:
:return: :return: API reply.
""" """
result = apihelper.get_chat_member_count(self.token, chat_id) result = apihelper.get_chat_member_count(self.token, chat_id)
return result return result
@ -948,10 +973,12 @@ class TeleBot:
Use the field can_set_sticker_set optionally returned in getChat requests to check 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. if the bot can use this method. Returns True on success.
Telegram documentation: https://core.telegram.org/bots/api#setchatstickerset
:param chat_id: Unique identifier for the target chat or username of the target supergroup :param chat_id: Unique identifier for the target chat or username of the target supergroup
(in the format @supergroupusername) (in the format @supergroupusername)
:param sticker_set_name: Name of the sticker set to be set as the group sticker set :param sticker_set_name: Name of the sticker set to be set as the group sticker set
:return: :return: API reply.
""" """
result = apihelper.set_chat_sticker_set(self.token, chat_id, sticker_set_name) result = apihelper.set_chat_sticker_set(self.token, chat_id, sticker_set_name)
return result return result
@ -962,9 +989,11 @@ class TeleBot:
for this to work and must have the appropriate admin rights. Use the field can_set_sticker_set for this to work and must have the appropriate admin 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. optionally returned in getChat requests to check if the bot can use this method. Returns True on success.
Telegram documentation: https://core.telegram.org/bots/api#deletechatstickerset
:param chat_id: Unique identifier for the target chat or username of the target supergroup :param chat_id: Unique identifier for the target chat or username of the target supergroup
(in the format @supergroupusername) (in the format @supergroupusername)
:return: :return: API reply.
""" """
result = apihelper.delete_chat_sticker_set(self.token, chat_id) result = apihelper.delete_chat_sticker_set(self.token, chat_id)
return result return result
@ -973,9 +1002,11 @@ class TeleBot:
""" """
Use this method to get information about a member of a chat. Returns a ChatMember object on success. Use this method to get information about a member of a chat. Returns a ChatMember object on success.
Telegram documentation: https://core.telegram.org/bots/api#getchatmember
:param chat_id: :param chat_id:
:param user_id: :param user_id:
:return: :return: API reply.
""" """
result = apihelper.get_chat_member(self.token, chat_id, user_id) result = apihelper.get_chat_member(self.token, chat_id, user_id)
return types.ChatMember.de_json(result) return types.ChatMember.de_json(result)
@ -998,6 +1029,8 @@ class TeleBot:
If you must send more than 4000 characters, If you must send more than 4000 characters,
use the `split_string` or `smart_split` function in util.py. use the `split_string` or `smart_split` function in util.py.
Telegram documentation: https://core.telegram.org/bots/api#sendmessage
:param chat_id: Unique identifier for the target chat or username of the target channel (in the format @channelusername) :param chat_id: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
:param text: Text of the message to be sent :param text: Text of the message to be sent
:param parse_mode: Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your bot's message. :param parse_mode: Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your bot's message.
@ -1009,7 +1042,7 @@ class TeleBot:
:param allow_sending_without_reply: Pass True, if the message should be sent even if the specified replied-to message is not found :param allow_sending_without_reply: Pass True, if the message should be sent even if the specified replied-to message is not found
:param reply_markup: Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. :param reply_markup: Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.
:param timeout: :param timeout:
:return: :return: API reply.
""" """
parse_mode = self.parse_mode if (parse_mode is None) else parse_mode parse_mode = self.parse_mode if (parse_mode is None) else parse_mode
@ -1027,6 +1060,8 @@ class TeleBot:
""" """
Use this method to forward messages of any kind. Use this method to forward messages of any kind.
Telegram documentation: https://core.telegram.org/bots/api#forwardmessage
:param disable_notification: :param disable_notification:
:param chat_id: which chat to forward :param chat_id: which chat to forward
:param from_chat_id: which chat message from :param from_chat_id: which chat message from
@ -1054,6 +1089,8 @@ class TeleBot:
""" """
Use this method to copy messages of any kind. Use this method to copy messages of any kind.
Telegram documentation: https://core.telegram.org/bots/api#copymessage
:param chat_id: which chat to forward :param chat_id: which chat to forward
:param from_chat_id: which chat message from :param from_chat_id: which chat message from
:param message_id: message id :param message_id: message id
@ -1078,6 +1115,8 @@ class TeleBot:
""" """
Use this method to delete message. Returns True on success. Use this method to delete message. Returns True on success.
Telegram documentation: https://core.telegram.org/bots/api#deletemessage
:param chat_id: in which chat to delete :param chat_id: in which chat to delete
:param message_id: which message to delete :param message_id: which message to delete
:param timeout: :param timeout:
@ -1096,6 +1135,8 @@ class TeleBot:
""" """
Use this method to send dices. Use this method to send dices.
Telegram documentation: https://core.telegram.org/bots/api#senddice
:param chat_id: :param chat_id:
:param emoji: :param emoji:
:param disable_notification: :param disable_notification:
@ -1125,6 +1166,8 @@ class TeleBot:
""" """
Use this method to send photos. On success, the sent Message is returned. Use this method to send photos. On success, the sent Message is returned.
Telegram documentation: https://core.telegram.org/bots/api#sendphoto
:param chat_id: :param chat_id:
:param photo: :param photo:
:param caption: :param caption:
@ -1164,6 +1207,8 @@ class TeleBot:
Use this method to send audio files, if you want Telegram clients to display them in the music player. 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 format. Your audio must be in the .mp3 format.
Telegram documentation: https://core.telegram.org/bots/api#sendaudio
:param chat_id:Unique identifier for the message recipient :param chat_id:Unique identifier for the message recipient
:param audio:Audio file to send. :param audio:Audio file to send.
:param caption: :param caption:
@ -1205,10 +1250,12 @@ class TeleBot:
Use this method to send audio files, if you want Telegram clients to display the file Use this method to send audio files, if you want Telegram clients to display the file
as a playable voice message. as a playable voice message.
:param chat_id:Unique identifier for the message recipient. Telegram documentation: https://core.telegram.org/bots/api#sendvoice
:param chat_id: Unique identifier for the message recipient.
:param voice: :param voice:
:param caption: :param caption:
:param duration:Duration of sent audio in seconds :param duration: Duration of sent audio in seconds
:param reply_to_message_id: :param reply_to_message_id:
:param reply_markup: :param reply_markup:
:param parse_mode :param parse_mode
@ -1246,6 +1293,8 @@ class TeleBot:
""" """
Use this method to send general files. Use this method to send general files.
Telegram documentation: https://core.telegram.org/bots/api#senddocument
:param chat_id: Unique identifier for the target chat or username of the target channel (in the format @channelusername) :param chat_id: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
:param document: (document) File to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data :param document: (document) File to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data
:param reply_to_message_id: If the message is a reply, ID of the original message :param reply_to_message_id: If the message is a reply, ID of the original message
@ -1291,6 +1340,8 @@ class TeleBot:
""" """
Use this method to send .webp stickers. Use this method to send .webp stickers.
Telegram documentation: https://core.telegram.org/bots/api#sendsticker
:param chat_id: :param chat_id:
:param sticker: :param sticker:
:param data: :param data:
@ -1334,6 +1385,8 @@ class TeleBot:
""" """
Use this method to send video files, Telegram clients support mp4 videos (other formats may be sent as Document). Use this method to send video files, Telegram clients support mp4 videos (other formats may be sent as Document).
Telegram documentation: https://core.telegram.org/bots/api#sendvideo
:param chat_id: Unique identifier for the target chat or username of the target channel (in the format @channelusername) :param chat_id: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
:param video: Video to send. You can either pass a file_id as String to resend a video that is already on the Telegram servers, or upload a new video file using multipart/form-data. :param video: Video to send. You can either pass a file_id as String to resend a video that is already on the Telegram servers, or upload a new video file using multipart/form-data.
:param duration: Duration of sent video in seconds :param duration: Duration of sent video in seconds
@ -1381,6 +1434,8 @@ class TeleBot:
""" """
Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound). Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound).
Telegram documentation: https://core.telegram.org/bots/api#sendanimation
:param chat_id: Integer : Unique identifier for the message recipient User or GroupChat id :param chat_id: Integer : Unique identifier for the message recipient User or GroupChat id
:param animation: InputFile or String : Animation to send. You can either pass a file_id as String to resend an :param animation: InputFile or String : Animation to send. You can either pass a file_id as String to resend an
animation that is already on the Telegram server animation that is already on the Telegram server
@ -1423,6 +1478,8 @@ class TeleBot:
As of v.4.0, Telegram clients support rounded square mp4 videos of up to 1 minute long. Use this method to send As of v.4.0, Telegram clients support rounded square mp4 videos of up to 1 minute long. Use this method to send
video messages. video messages.
Telegram documentation: https://core.telegram.org/bots/api#sendvideonote
:param chat_id: Integer : Unique identifier for the message recipient User or GroupChat id :param chat_id: Integer : Unique identifier for the message recipient User or GroupChat id
:param data: InputFile or String : Video note to send. You can either pass a file_id as String to resend :param data: InputFile or String : Video note to send. You can either pass a file_id as String to resend
a video that is already on the Telegram server a video that is already on the Telegram server
@ -1455,6 +1512,8 @@ class TeleBot:
""" """
Send a group of photos or videos as an album. On success, an array of the sent Messages is returned. Send a group of photos or videos as an album. On success, an array of the sent Messages is returned.
Telegram documentation: https://core.telegram.org/bots/api#sendmediagroup
:param chat_id: :param chat_id:
:param media: :param media:
:param disable_notification: :param disable_notification:
@ -1486,6 +1545,8 @@ class TeleBot:
""" """
Use this method to send point on the map. Use this method to send point on the map.
Telegram documentation: https://core.telegram.org/bots/api#sendlocation
:param chat_id: :param chat_id:
:param latitude: :param latitude:
:param longitude: :param longitude:
@ -1521,6 +1582,8 @@ class TeleBot:
""" """
Use this method to edit live location. Use this method to edit live location.
Telegram documentation: https://core.telegram.org/bots/api#editmessagelivelocation
:param latitude: :param latitude:
:param longitude: :param longitude:
:param chat_id: :param chat_id:
@ -1549,6 +1612,8 @@ class TeleBot:
Use this method to stop updating a live location message sent by the bot Use this method to stop updating a live location message sent by the bot
or via the bot (for inline bots) before live_period expires or via the bot (for inline bots) before live_period expires
Telegram documentation: https://core.telegram.org/bots/api#stopmessagelivelocation
:param chat_id: :param chat_id:
:param message_id: :param message_id:
:param inline_message_id: :param inline_message_id:
@ -1578,6 +1643,8 @@ class TeleBot:
""" """
Use this method to send information about a venue. Use this method to send information about a venue.
Telegram documentation: https://core.telegram.org/bots/api#sendvenue
:param chat_id: Integer or String : Unique identifier for the target chat or username of the target channel :param chat_id: Integer or String : Unique identifier for the target chat or username of the target channel
:param latitude: Float : Latitude of the venue :param latitude: Float : Latitude of the venue
:param longitude: Float : Longitude of the venue :param longitude: Float : Longitude of the venue
@ -1613,6 +1680,25 @@ class TeleBot:
timeout: Optional[int]=None, timeout: Optional[int]=None,
allow_sending_without_reply: Optional[bool]=None, allow_sending_without_reply: Optional[bool]=None,
protect_content: Optional[bool]=None) -> types.Message: protect_content: Optional[bool]=None) -> types.Message:
"""
Use this method to send phone contacts.
Telegram documentation: https://core.telegram.org/bots/api#sendcontact
:param chat_id: Integer or String : Unique identifier for the target chat or username of the target channel
:param phone_number: String : Contact's phone number
:param first_name: String : Contact's first name
:param last_name: String : Contact's last name
:param vcard: String : Additional data about the contact in the form of a vCard, 0-2048 bytes
:param disable_notification:
:param reply_to_message_id:
:param reply_markup:
:param timeout:
:param allow_sending_without_reply:
:param protect_content:
:return:
"""
return types.Message.de_json( return types.Message.de_json(
apihelper.send_contact( apihelper.send_contact(
self.token, chat_id, phone_number, first_name, last_name, vcard, self.token, chat_id, phone_number, first_name, last_name, vcard,
@ -1626,6 +1712,8 @@ class TeleBot:
The status is set for 5 seconds or less (when a message arrives from your bot, Telegram clients clear The status is set for 5 seconds or less (when a message arrives from your bot, Telegram clients clear
its typing status). its typing status).
Telegram documentation: https://core.telegram.org/bots/api#sendchataction
:param chat_id: :param chat_id:
:param action: One of the following strings: 'typing', 'upload_photo', 'record_video', 'upload_video', :param action: One of the following strings: 'typing', 'upload_photo', 'record_video', 'upload_video',
'record_audio', 'upload_audio', 'upload_document', 'find_location', 'record_video_note', 'record_audio', 'upload_audio', 'upload_document', 'find_location', 'record_video_note',
@ -1655,6 +1743,8 @@ class TeleBot:
own using invite links, etc., unless unbanned first. own using invite links, etc., unless unbanned first.
Returns True on success. Returns True on success.
Telegram documentation: https://core.telegram.org/bots/api#banchatmember
:param chat_id: Int or string : Unique identifier for the target group or username of the target supergroup :param chat_id: Int or string : Unique identifier for the target group or username of the target supergroup
:param user_id: Int : Unique identifier of the target user :param user_id: Int : Unique identifier of the target user
:param until_date: Date when the user will be unbanned, unix time. If user is banned for more than 366 days or :param until_date: Date when the user will be unbanned, unix time. If user is banned for more than 366 days or
@ -1676,6 +1766,8 @@ class TeleBot:
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 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. they will also be removed from the chat. If you don't want this, use the parameter only_if_banned.
Telegram documentation: https://core.telegram.org/bots/api#unbanchatmember
:param chat_id: Unique identifier for the target group or username of the target supergroup or channel :param chat_id: Unique identifier for the target group or username of the target supergroup or channel
(in the format @username) (in the format @username)
:param user_id: Unique identifier of the target user :param user_id: Unique identifier of the target user
@ -1700,6 +1792,8 @@ class TeleBot:
The bot must be an administrator in the supergroup for this to work and must have The bot must be an administrator in the supergroup for this to work and must have
the appropriate admin rights. Pass True for all boolean parameters to lift restrictions from a user. the appropriate admin rights. Pass True for all boolean parameters to lift restrictions from a user.
Telegram documentation: https://core.telegram.org/bots/api#restrictchatmember
:param chat_id: Int or String : Unique identifier for the target group or username of the target supergroup :param chat_id: Int or String : Unique identifier for the target group or username of the target supergroup
or channel (in the format @channelusername) or channel (in the format @channelusername)
:param user_id: Int : Unique identifier of the target user :param user_id: Int : Unique identifier of the target user
@ -1746,6 +1840,8 @@ class TeleBot:
in the chat for this to work and must have the appropriate admin rights. in the chat for this to work and must have the appropriate admin rights.
Pass False for all boolean parameters to demote a user. Pass False for all boolean parameters to demote a user.
Telegram documentation: https://core.telegram.org/bots/api#promotechatmember
:param chat_id: Unique identifier for the target chat or username of the target channel ( :param chat_id: Unique identifier for the target chat or username of the target channel (
in the format @channelusername) in the format @channelusername)
:param user_id: Int : Unique identifier of the target user :param user_id: Int : Unique identifier of the target user
@ -1780,6 +1876,8 @@ class TeleBot:
Use this method to set a custom title for an administrator Use this method to set a custom title for an administrator
in a supergroup promoted by the bot. in a supergroup promoted by the bot.
Telegram documentation: https://core.telegram.org/bots/api#setchatadministratorcustomtitle
:param chat_id: Unique identifier for the target chat or username of the target supergroup :param chat_id: Unique identifier for the target chat or username of the target supergroup
(in the format @supergroupusername) (in the format @supergroupusername)
:param user_id: Unique identifier of the target user :param user_id: Unique identifier of the target user
@ -1798,6 +1896,8 @@ class TeleBot:
for this to work and must have the appropriate administrator rights. for this to work and must have the appropriate administrator rights.
Returns True on success. Returns True on success.
Telegram documentation: https://core.telegram.org/bots/api#banchatsenderchat
:param chat_id: Unique identifier for the target chat or username of the target channel (in the format @channelusername) :param chat_id: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
:param sender_chat_id: Unique identifier of the target sender chat :param sender_chat_id: Unique identifier of the target sender chat
:return: True on success. :return: True on success.
@ -1811,6 +1911,8 @@ class TeleBot:
administrator rights. administrator rights.
Returns True on success. Returns True on success.
Telegram documentation: https://core.telegram.org/bots/api#unbanchatsenderchat
:params: :params:
:param chat_id: Unique identifier for the target chat or username of the target channel (in the format @channelusername) :param chat_id: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
:param sender_chat_id: Unique identifier of the target sender chat :param sender_chat_id: Unique identifier of the target sender chat
@ -1825,6 +1927,8 @@ class TeleBot:
The bot must be an administrator in the group or a supergroup for this to work The bot must be an administrator in the group or a supergroup for this to work
and must have the can_restrict_members admin rights. and must have the can_restrict_members admin rights.
Telegram documentation: https://core.telegram.org/bots/api#setchatpermissions
:param chat_id: Unique identifier for the target chat or username of the target supergroup :param chat_id: Unique identifier for the target chat or username of the target supergroup
(in the format @supergroupusername) (in the format @supergroupusername)
:param permissions: New default chat permissions :param permissions: New default chat permissions
@ -1842,6 +1946,8 @@ class TeleBot:
Use this method to create an additional invite link for a chat. 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 admin rights. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
Telegram documentation: https://core.telegram.org/bots/api#createchatinvitelink
:param chat_id: Id: Unique identifier for the target chat or username of the target channel :param chat_id: Id: Unique identifier for the target chat or username of the target channel
(in the format @channelusername) (in the format @channelusername)
:param name: Invite link name; 0-32 characters :param name: Invite link name; 0-32 characters
@ -1865,6 +1971,8 @@ class TeleBot:
Use this method to edit a non-primary invite link created by the bot. 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 admin rights. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
Telegram documentation: https://core.telegram.org/bots/api#editchatinvitelink
:param chat_id: Id: Unique identifier for the target chat or username of the target channel :param chat_id: Id: Unique identifier for the target chat or username of the target channel
(in the format @channelusername) (in the format @channelusername)
:param name: Invite link name; 0-32 characters :param name: Invite link name; 0-32 characters
@ -1885,6 +1993,8 @@ class TeleBot:
Note: If the primary link is revoked, a new link is automatically generated The bot must be an administrator Note: 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 admin rights. in the chat for this to work and must have the appropriate admin rights.
Telegram documentation: https://core.telegram.org/bots/api#revokechatinvitelink
:param chat_id: Id: Unique identifier for the target chat or username of the target channel :param chat_id: Id: Unique identifier for the target chat or username of the target channel
(in the format @channelusername) (in the format @channelusername)
:param invite_link: The invite link to revoke :param invite_link: The invite link to revoke
@ -1899,6 +2009,8 @@ class TeleBot:
Use this method to export an invite link to a supergroup or a channel. The bot must be an administrator Use this method to export an invite link to a supergroup or a channel. The bot must be an administrator
in the chat for this to work and must have the appropriate admin rights. in the chat for this to work and must have the appropriate admin rights.
Telegram documentation: https://core.telegram.org/bots/api#exportchatinvitelink
:param chat_id: Id: Unique identifier for the target chat or username of the target channel :param chat_id: Id: Unique identifier for the target chat or username of the target channel
(in the format @channelusername) (in the format @channelusername)
:return: exported invite link as String on success. :return: exported invite link as String on success.
@ -1911,6 +2023,8 @@ class TeleBot:
The bot must be an administrator in the chat for this to work and must have 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. the can_invite_users administrator right. Returns True on success.
Telegram documentation: https://core.telegram.org/bots/api#approvechatjoinrequest
:param chat_id: Unique identifier for the target chat or username of the target supergroup :param chat_id: Unique identifier for the target chat or username of the target supergroup
(in the format @supergroupusername) (in the format @supergroupusername)
:param user_id: Unique identifier of the target user :param user_id: Unique identifier of the target user
@ -1924,6 +2038,8 @@ class TeleBot:
The bot must be an administrator in the chat for this to work and must have 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. the can_invite_users administrator right. Returns True on success.
Telegram documentation: https://core.telegram.org/bots/api#declinechatjoinrequest
:param chat_id: Unique identifier for the target chat or username of the target supergroup :param chat_id: Unique identifier for the target chat or username of the target supergroup
(in the format @supergroupusername) (in the format @supergroupusername)
:param user_id: Unique identifier of the target user :param user_id: Unique identifier of the target user
@ -1939,6 +2055,8 @@ class TeleBot:
Note: In regular groups (non-supergroups), this method will only work if the All Members Are Admins Note: In regular groups (non-supergroups), this method will only work if the All Members Are Admins
setting is off in the target group. setting is off in the target group.
Telegram documentation: https://core.telegram.org/bots/api#setchatphoto
:param chat_id: Int or Str: Unique identifier for the target chat or username of the target channel :param chat_id: Int or Str: Unique identifier for the target chat or username of the target channel
(in the format @channelusername) (in the format @channelusername)
:param photo: InputFile: New chat photo, uploaded using multipart/form-data :param photo: InputFile: New chat photo, uploaded using multipart/form-data
@ -1954,6 +2072,8 @@ class TeleBot:
Note: In regular groups (non-supergroups), this method will only work if the All Members Are Admins Note: In regular groups (non-supergroups), this method will only work if the All Members Are Admins
setting is off in the target group. setting is off in the target group.
Telegram documentation: https://core.telegram.org/bots/api#deletechatphoto
:param chat_id: Int or Str: Unique identifier for the target chat or username of the target channel :param chat_id: Int or Str: Unique identifier for the target chat or username of the target channel
(in the format @channelusername) (in the format @channelusername)
""" """
@ -1965,6 +2085,8 @@ class TeleBot:
Use this method to get the current list of the bot's commands. Use this method to get the current list of the bot's commands.
Returns List of BotCommand on success. Returns List of BotCommand on success.
Telegram documentation: https://core.telegram.org/bots/api#getmycommands
:param scope: The scope of users for which the commands are relevant. :param scope: The scope of users for which the commands are relevant.
Defaults to BotCommandScopeDefault. Defaults to BotCommandScopeDefault.
:param language_code: A two-letter ISO 639-1 language code. If empty, :param language_code: A two-letter ISO 639-1 language code. If empty,
@ -1980,6 +2102,8 @@ class TeleBot:
""" """
Use this method to change the list of the bot's commands. Use this method to change the list of the bot's commands.
Telegram documentation: https://core.telegram.org/bots/api#setmycommands
:param commands: List of BotCommand. At most 100 commands can be specified. :param commands: List of BotCommand. At most 100 commands can be specified.
:param scope: The scope of users for which the commands are relevant. :param scope: The scope of users for which the commands are relevant.
Defaults to BotCommandScopeDefault. Defaults to BotCommandScopeDefault.
@ -1997,6 +2121,8 @@ class TeleBot:
After deletion, higher level commands will be shown to affected users. After deletion, higher level commands will be shown to affected users.
Returns True on success. Returns True on success.
Telegram documentation: https://core.telegram.org/bots/api#deletemycommands
:param scope: The scope of users for which the commands are relevant. :param scope: The scope of users for which the commands are relevant.
Defaults to BotCommandScopeDefault. Defaults to BotCommandScopeDefault.
:param language_code: A two-letter ISO 639-1 language code. If empty, :param language_code: A two-letter ISO 639-1 language code. If empty,
@ -2013,6 +2139,8 @@ class TeleBot:
Note: In regular groups (non-supergroups), this method will only work if the All Members Are Admins Note: In regular groups (non-supergroups), this method will only work if the All Members Are Admins
setting is off in the target group. setting is off in the target group.
Telegram documentation: https://core.telegram.org/bots/api#setchattitle
:param chat_id: Int or Str: Unique identifier for the target chat or username of the target channel :param chat_id: Int or Str: Unique identifier for the target chat or username of the target channel
(in the format @channelusername) (in the format @channelusername)
:param title: New chat title, 1-255 characters :param title: New chat title, 1-255 characters
@ -2025,6 +2153,8 @@ class TeleBot:
Use this method to change the description of a supergroup or a channel. Use this method to change the description of a supergroup or a channel.
The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
Telegram documentation: https://core.telegram.org/bots/api#setchatdescription
:param chat_id: Int or Str: Unique identifier for the target chat or username of the target channel :param chat_id: Int or Str: Unique identifier for the target chat or username of the target channel
(in the format @channelusername) (in the format @channelusername)
:param description: Str: New chat description, 0-255 characters :param description: Str: New chat description, 0-255 characters
@ -2040,6 +2170,8 @@ class TeleBot:
The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
Returns True on success. Returns True on success.
Telegram documentation: https://core.telegram.org/bots/api#pinchatmessage
:param chat_id: Int or Str: Unique identifier for the target chat or username of the target channel :param chat_id: Int or Str: Unique identifier for the target chat or username of the target channel
(in the format @channelusername) (in the format @channelusername)
:param message_id: Int: Identifier of a message to pin :param message_id: Int: Identifier of a message to pin
@ -2055,6 +2187,8 @@ class TeleBot:
The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
Returns True on success. Returns True on success.
Telegram documentation: https://core.telegram.org/bots/api#unpinchatmessage
:param chat_id: Int or Str: Unique identifier for the target chat or username of the target channel :param chat_id: Int or Str: Unique identifier for the target chat or username of the target channel
(in the format @channelusername) (in the format @channelusername)
:param message_id: Int: Identifier of a message to unpin :param message_id: Int: Identifier of a message to unpin
@ -2068,6 +2202,8 @@ class TeleBot:
The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
Returns True on success. Returns True on success.
Telegram documentation: https://core.telegram.org/bots/api#unpinallchatmessages
:param chat_id: Int or Str: Unique identifier for the target chat or username of the target channel :param chat_id: Int or Str: Unique identifier for the target chat or username of the target channel
(in the format @channelusername) (in the format @channelusername)
:return: :return:
@ -2086,6 +2222,8 @@ class TeleBot:
""" """
Use this method to edit text and game messages. Use this method to edit text and game messages.
Telegram documentation: https://core.telegram.org/bots/api#editmessagetext
:param text: :param text:
:param chat_id: :param chat_id:
:param message_id: :param message_id:
@ -2115,6 +2253,8 @@ class TeleBot:
Otherwise, message type can be changed arbitrarily. When inline message is edited, new file can't be uploaded. Otherwise, message type can be changed arbitrarily. When inline message is edited, new file can't be uploaded.
Use previously uploaded file via its file_id or specify a URL. Use previously uploaded file via its file_id or specify a URL.
Telegram documentation: https://core.telegram.org/bots/api#editmessagemedia
:param media: :param media:
:param chat_id: :param chat_id:
:param message_id: :param message_id:
@ -2135,6 +2275,8 @@ class TeleBot:
""" """
Use this method to edit only the reply markup of messages. Use this method to edit only the reply markup of messages.
Telegram documentation: https://core.telegram.org/bots/api#editmessagereplymarkup
:param chat_id: :param chat_id:
:param message_id: :param message_id:
:param inline_message_id: :param inline_message_id:
@ -2155,7 +2297,9 @@ class TeleBot:
allow_sending_without_reply: Optional[bool]=None, allow_sending_without_reply: Optional[bool]=None,
protect_content: Optional[bool]=None) -> types.Message: protect_content: Optional[bool]=None) -> types.Message:
""" """
Used to send the game Used to send the game.
Telegram documentation: https://core.telegram.org/bots/api#sendgame
:param chat_id: :param chat_id:
:param game_short_name: :param game_short_name:
@ -2183,6 +2327,8 @@ class TeleBot:
""" """
Sets the value of points in the game to a specific user. Sets the value of points in the game to a specific user.
Telegram documentation: https://core.telegram.org/bots/api#setgamecore
:param user_id: :param user_id:
:param score: :param score:
:param force: :param force:
@ -2203,7 +2349,9 @@ class TeleBot:
message_id: Optional[int]=None, message_id: Optional[int]=None,
inline_message_id: Optional[str]=None) -> List[types.GameHighScore]: inline_message_id: Optional[str]=None) -> List[types.GameHighScore]:
""" """
Gets top points and game play Gets top points and game play.
Telegram documentation: https://core.telegram.org/bots/api#getgamehighscores
:param user_id: :param user_id:
:param chat_id: :param chat_id:
@ -2238,6 +2386,8 @@ class TeleBot:
""" """
Sends invoice. Sends invoice.
Telegram documentation: https://core.telegram.org/bots/api#sendinvoice
:param chat_id: Unique identifier for the target private chat :param chat_id: Unique identifier for the target private chat
:param title: Product name :param title: Product name
:param description: Product description :param description: Product description
@ -2308,6 +2458,8 @@ class TeleBot:
""" """
Sends a poll. Sends a poll.
Telegram documentation: https://core.telegram.org/bots/api#sendpoll
:param chat_id: :param chat_id:
:param question: :param question:
:param options: array of str with answers :param options: array of str with answers
@ -2347,6 +2499,8 @@ class TeleBot:
""" """
Stops a poll. Stops a poll.
Telegram documentation: https://core.telegram.org/bots/api#stoppoll
:param chat_id: :param chat_id:
:param message_id: :param message_id:
:param reply_markup: :param reply_markup:
@ -2361,6 +2515,8 @@ class TeleBot:
""" """
Asks for an answer to a shipping question. Asks for an answer to a shipping question.
Telegram documentation: https://core.telegram.org/bots/api#answershippingquery
:param shipping_query_id: :param shipping_query_id:
:param ok: :param ok:
:param shipping_options: :param shipping_options:
@ -2375,6 +2531,8 @@ class TeleBot:
""" """
Response to a request for pre-inspection. Response to a request for pre-inspection.
Telegram documentation: https://core.telegram.org/bots/api#answerprecheckoutquery
:param pre_checkout_query_id: :param pre_checkout_query_id:
:param ok: :param ok:
:param error_message: :param error_message:
@ -2392,6 +2550,8 @@ class TeleBot:
""" """
Use this method to edit captions of messages. Use this method to edit captions of messages.
Telegram documentation: https://core.telegram.org/bots/api#editmessagecaption
:param caption: :param caption:
:param chat_id: :param chat_id:
:param message_id: :param message_id:
@ -2432,6 +2592,8 @@ class TeleBot:
Use this method to send answers to an inline query. On success, True is returned. Use this method to send answers to an inline query. On success, True is returned.
No more than 50 results per query are allowed. No more than 50 results per query are allowed.
Telegram documentation: https://core.telegram.org/bots/api#answerinlinequery
:param inline_query_id: Unique identifier for the answered query :param inline_query_id: Unique identifier for the answered query
:param results: Array of results for the inline query :param results: Array of results for the inline query
:param cache_time: The maximum amount of time in seconds that the result of the inline query :param cache_time: The maximum amount of time in seconds that the result of the inline query
@ -2456,6 +2618,8 @@ class TeleBot:
Use this method to send answers to callback queries sent from inline keyboards. The answer will be displayed to 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. the user as a notification at the top of the chat screen or as an alert.
Telegram documentation: https://core.telegram.org/bots/api#answercallbackquery
:param callback_query_id: :param callback_query_id:
:param text: :param text:
:param show_alert: :param show_alert:
@ -2471,6 +2635,8 @@ class TeleBot:
Use this method to set the thumbnail of a sticker set. Use this method to set the thumbnail of a sticker set.
Animated thumbnails can be set for animated sticker sets only. Returns True on success. Animated thumbnails can be set for animated sticker sets only. Returns True on success.
Telegram documentation: https://core.telegram.org/bots/api#setstickersetthumb
:param name: Sticker set name :param name: Sticker set name
:param user_id: User identifier :param user_id: User identifier
:param thumb: :param thumb:
@ -2481,6 +2647,8 @@ class TeleBot:
""" """
Use this method to get a sticker set. On success, a StickerSet object is returned. Use this method to get a sticker set. On success, a StickerSet object is returned.
Telegram documentation: https://core.telegram.org/bots/api#getstickerset
:param name: :param name:
:return: :return:
""" """
@ -2492,6 +2660,8 @@ class TeleBot:
Use this method to upload a .png file with a sticker for later use in createNewStickerSet and addStickerToSet Use this method to upload a .png file with a sticker for later use in createNewStickerSet and addStickerToSet
methods (can be used multiple times). Returns the uploaded File on success. methods (can be used multiple times). Returns the uploaded File on success.
Telegram documentation: https://core.telegram.org/bots/api#uploadstickerfile
:param user_id: :param user_id:
:param png_sticker: :param png_sticker:
:return: :return:
@ -2512,6 +2682,8 @@ class TeleBot:
The bot will be able to edit the created sticker set. The bot will be able to edit the created sticker set.
Returns True on success. Returns True on success.
Telegram documentation: https://core.telegram.org/bots/api#createnewstickerset
:param user_id: :param user_id:
:param name: :param name:
:param title: :param title:
@ -2538,6 +2710,8 @@ class TeleBot:
It's required to pass `png_sticker` or `tgs_sticker`. It's required to pass `png_sticker` or `tgs_sticker`.
Returns True on success. Returns True on success.
Telegram documentation: https://core.telegram.org/bots/api#addstickertoset
:param user_id: :param user_id:
:param name: :param name:
:param emojis: :param emojis:
@ -2554,6 +2728,8 @@ class TeleBot:
""" """
Use this method to move a sticker in a set created by the bot to a specific position . Returns True on success. Use this method to move a sticker in a set created by the bot to a specific position . Returns True on success.
Telegram documentation: https://core.telegram.org/bots/api#setstickerpositioninset
:param sticker: :param sticker:
:param position: :param position:
:return: :return:
@ -2564,6 +2740,8 @@ class TeleBot:
""" """
Use this method to delete a sticker from a set created by the bot. Returns True on success. Use this method to delete a sticker from a set created by the bot. Returns True on success.
Telegram documentation: https://core.telegram.org/bots/api#deletestickerfromset
:param sticker: :param sticker:
:return: :return:
""" """
@ -3206,6 +3384,7 @@ class TeleBot:
def register_edited_channel_post_handler(self, callback, content_types=None, commands=None, regexp=None, func=None, pass_bot=False, **kwargs): def register_edited_channel_post_handler(self, callback, content_types=None, commands=None, regexp=None, func=None, pass_bot=False, **kwargs):
""" """
Registers edited channel post message handler. Registers edited channel post message handler.
:param callback: function to be called :param callback: function to be called
:param content_types: list of content_types :param content_types: list of content_types
:param commands: list of commands :param commands: list of commands