@@ -343,7 +343,7 @@ def get_updates(self, offset: Optional[int]=None, limit: Optional[int]=None,
343343 :param offset: Integer. Identifier of the first update to be returned.
344344 :param limit: Integer. Limits the number of updates to be retrieved.
345345 :param timeout: Integer. Request connection timeout
346- :param long_polling_timeout. Timeout in seconds for long polling.
346+ :param long_polling_timeout: Timeout in seconds for long polling.
347347 :return: array of Updates
348348 """
349349 json_updates = apihelper .get_updates (self .token , offset , limit , timeout , allowed_updates , long_polling_timeout )
@@ -876,7 +876,7 @@ def get_chat_administrators(self, chat_id: Union[int, str]) -> List[types.ChatMe
876876 """
877877 Use this method to get a list of administrators in a chat.
878878 On success, returns an Array of ChatMember objects that contains
879- information about all chat administrators except other bots.
879+ information about all chat administrators except other bots.
880880
881881 Telegram documentation: https://core.telegram.org/bots/api#getchatadministrators
882882
@@ -932,8 +932,7 @@ def delete_chat_sticker_set(self, chat_id: Union[int, str]) -> bool:
932932
933933 Telegram documentation: https://core.telegram.org/bots/api#deletechatstickerset
934934
935- :param chat_id: Unique identifier for the target chat or username of the target supergroup
936- (in the format @supergroupusername)
935+ :param chat_id: Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
937936 :return: API reply.
938937 """
939938 result = apihelper .delete_chat_sticker_set (self .token , chat_id )
@@ -1199,7 +1198,7 @@ def send_voice(
11991198 :param duration: Duration of sent audio in seconds
12001199 :param reply_to_message_id:
12011200 :param reply_markup:
1202- :param parse_mode
1201+ :param parse_mode:
12031202 :param disable_notification:
12041203 :param timeout:
12051204 :param caption_entities:
@@ -1663,7 +1662,7 @@ def send_chat_action(
16631662 :return: API reply. :type: boolean
16641663 """
16651664 return apihelper .send_chat_action (self .token , chat_id , action , timeout )
1666-
1665+
16671666 def kick_chat_member (
16681667 self , chat_id : Union [int , str ], user_id : int ,
16691668 until_date :Optional [Union [int , datetime ]]= None ,
@@ -1742,11 +1741,10 @@ def restrict_chat_member(
17421741 If user is restricted for more than 366 days or less than 30 seconds from the current time,
17431742 they are considered to be restricted forever
17441743 :param can_send_messages: Pass True, if the user can send text messages, contacts, locations and venues
1745- :param can_send_media_messages Pass True, if the user can send audios, documents, photos, videos, video notes
1744+ :param can_send_media_messages: Pass True, if the user can send audios, documents, photos, videos, video notes
17461745 and voice notes, implies can_send_messages
17471746 :param can_send_polls: Pass True, if the user is allowed to send polls, implies can_send_messages
1748- :param can_send_other_messages: Pass True, if the user can send animations, games, stickers and
1749- use inline bots, implies can_send_media_messages
1747+ :param can_send_other_messages: Pass True, if the user can send animations, games, stickers and use inline bots, implies can_send_media_messages
17501748 :param can_add_web_page_previews: Pass True, if the user may add web page previews to their messages,
17511749 implies can_send_media_messages
17521750 :param can_change_info: Pass True, if the user is allowed to change the chat title, photo and other settings.
@@ -1932,7 +1930,7 @@ def revoke_chat_invite_link(
19321930 """
19331931 Use this method to revoke an invite link created by the bot.
19341932 Note: If the primary link is revoked, a new link is automatically generated The bot must be an administrator
1935- in the chat for this to work and must have the appropriate admin rights.
1933+ in the chat for this to work and must have the appropriate admin rights.
19361934
19371935 Telegram documentation: https://core.telegram.org/bots/api#revokechatinvitelink
19381936
@@ -1994,7 +1992,7 @@ def set_chat_photo(self, chat_id: Union[int, str], photo: Any) -> bool:
19941992 The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
19951993 Returns True on success.
19961994 Note: In regular groups (non-supergroups), this method will only work if the ‘All Members Are Admins’
1997- setting is off in the target group.
1995+ setting is off in the target group.
19981996
19991997 Telegram documentation: https://core.telegram.org/bots/api#setchatphoto
20001998
@@ -2010,8 +2008,7 @@ def delete_chat_photo(self, chat_id: Union[int, str]) -> bool:
20102008 Use this method to delete a chat photo. Photos can't be changed for private chats.
20112009 The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
20122010 Returns True on success.
2013- Note: In regular groups (non-supergroups), this method will only work if the ‘All Members Are Admins’
2014- setting is off in the target group.
2011+ Note: In regular groups (non-supergroups), this method will only work if the ‘All Members Are Admins’ setting is off in the target group.
20152012
20162013 Telegram documentation: https://core.telegram.org/bots/api#deletechatphoto
20172014
@@ -2078,7 +2075,7 @@ def set_chat_title(self, chat_id: Union[int, str], title: str) -> bool:
20782075 The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
20792076 Returns True on success.
20802077 Note: In regular groups (non-supergroups), this method will only work if the ‘All Members Are Admins’
2081- setting is off in the target group.
2078+ setting is off in the target group.
20822079
20832080 Telegram documentation: https://core.telegram.org/bots/api#setchattitle
20842081
@@ -2989,30 +2986,32 @@ def message_handler(self, commands=None, regexp=None, func=None, content_types=N
29892986 All message handlers are tested in the order they were added.
29902987
29912988 Example:
2992-
2993- bot = TeleBot('TOKEN')
2994-
2995- # Handles all messages which text matches regexp.
2996- @bot.message_handler(regexp='someregexp')
2997- def command_help(message):
2998- bot.send_message(message.chat.id, 'Did someone call for help?')
2999-
3000- # Handles messages in private chat
3001- @bot.message_handler(chat_types=['private']) # You can add more chat types
3002- def command_help(message):
3003- bot.send_message(message.chat.id, 'Private chat detected, sir!')
3004-
3005- # Handle all sent documents of type 'text/plain'.
3006- @bot.message_handler(func=lambda message: message.document.mime_type == 'text/plain',
3007- content_types=['document'])
3008- def command_handle_document(message):
3009- bot.send_message(message.chat.id, 'Document received, sir!')
3010-
3011- # Handle all other messages.
3012- @bot.message_handler(func=lambda message: True, content_types=['audio', 'photo', 'voice', 'video', 'document',
3013- 'text', 'location', 'contact', 'sticker'])
3014- def default_command(message):
3015- bot.send_message(message.chat.id, "This is the default command handler.")
2989+
2990+ .. code-block:: python
2991+
2992+ bot = TeleBot('TOKEN')
2993+
2994+ # Handles all messages which text matches regexp.
2995+ @bot.message_handler(regexp='someregexp')
2996+ def command_help(message):
2997+ bot.send_message(message.chat.id, 'Did someone call for help?')
2998+
2999+ # Handles messages in private chat
3000+ @bot.message_handler(chat_types=['private']) # You can add more chat types
3001+ def command_help(message):
3002+ bot.send_message(message.chat.id, 'Private chat detected, sir!')
3003+
3004+ # Handle all sent documents of type 'text/plain'.
3005+ @bot.message_handler(func=lambda message: message.document.mime_type == 'text/plain',
3006+ content_types=['document'])
3007+ def command_handle_document(message):
3008+ bot.send_message(message.chat.id, 'Document received, sir!')
3009+
3010+ # Handle all other messages.
3011+ @bot.message_handler(func=lambda message: True, content_types=['audio', 'photo', 'voice', 'video', 'document',
3012+ 'text', 'location', 'contact', 'sticker'])
3013+ def default_command(message):
3014+ bot.send_message(message.chat.id, "This is the default command handler.")
30163015
30173016 :param commands: Optional list of strings (commands to handle).
30183017 :param regexp: Optional regular expression.
0 commit comments