@@ -451,7 +451,7 @@ def run_webhooks(self,
451451 drop_pending_updates : Optional [bool ] = None ,
452452 timeout : Optional [int ]= None ,
453453 secret_token : Optional [str ]= None ,
454- secret_token_length : Optional [int ]= 20 , ):
454+ secret_token_length : Optional [int ]= 20 ):
455455 """
456456 This class sets webhooks and listens to a given url and port.
457457
@@ -1028,7 +1028,7 @@ def polling(self, non_stop: Optional[bool]=False, skip_pending: Optional[bool]=F
10281028 :return:
10291029 """
10301030 if none_stop is not None :
1031- logger .warning ("polling: none_stop parameter is deprecated. Use non_stop instead." )
1031+ logger .warning ('The parameter "none_stop" is deprecated. Use " non_stop" instead.' )
10321032 non_stop = none_stop
10331033
10341034 if skip_pending :
@@ -1892,7 +1892,7 @@ def send_audio(
18921892 The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320.
18931893 Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file,
18941894 so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>
1895- :type thumbnail: :obj:`str`
1895+ :type thumbnail: :obj:`str` or :class:`telebot.types.InputFile`
18961896
18971897 :param caption_entities: A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode
18981898 :type caption_entities: :obj:`list` of :class:`telebot.types.MessageEntity`
@@ -1906,6 +1906,9 @@ def send_audio(
19061906 :param message_thread_id: Identifier of a message thread, in which the message will be sent
19071907 :type message_thread_id: :obj:`int`
19081908
1909+ :param thumb: Deprecated. Use thumbnail instead
1910+ :type thumb: :obj:`str` or :class:`telebot.types.InputFile`
1911+
19091912 :return: On success, the sent Message is returned.
19101913 :rtype: :class:`telebot.types.Message`
19111914 """
@@ -1916,7 +1919,7 @@ def send_audio(
19161919
19171920 if thumb is not None and thumbnail is None :
19181921 thumbnail = thumb
1919- logger .warning ('thumb is deprecated, use thumbnail instead' )
1922+ logger .warning ('The parameter " thumb" is deprecated. Use " thumbnail" instead. ' )
19201923
19211924 return types .Message .de_json (
19221925 apihelper .send_audio (
@@ -2072,6 +2075,9 @@ def send_document(
20722075 :param message_thread_id: The thread to which the message will be sent
20732076 :type message_thread_id: :obj:`int`
20742077
2078+ :param thumb: Deprecated. Use thumbnail instead
2079+ :type thumb: :obj:`str` or :class:`telebot.types.InputFile`
2080+
20752081 :return: On success, the sent Message is returned.
20762082 :rtype: :class:`telebot.types.Message`
20772083 """
@@ -2082,17 +2088,18 @@ def send_document(
20822088
20832089 if data and not (document ):
20842090 # function typo miss compatibility
2091+ logger .warning ('The parameter "data" is deprecated. Use "document" instead.' )
20852092 document = data
20862093
20872094 if thumb is not None and thumbnail is None :
20882095 thumbnail = thumb
2089- logger .warning ('thumb is deprecated, use thumbnail instead' )
2096+ logger .warning ('The parameter " thumb" is deprecated. Use " thumbnail" instead. ' )
20902097
20912098 return types .Message .de_json (
20922099 apihelper .send_data (
20932100 self .token , chat_id , document , 'document' ,
20942101 reply_to_message_id = reply_to_message_id , reply_markup = reply_markup , parse_mode = parse_mode ,
2095- disable_notification = disable_notification , timeout = timeout , caption = caption , thumb = thumbnail ,
2102+ disable_notification = disable_notification , timeout = timeout , caption = caption , thumbnail = thumbnail ,
20962103 caption_entities = caption_entities , allow_sending_without_reply = allow_sending_without_reply ,
20972104 disable_content_type_detection = disable_content_type_detection , visible_file_name = visible_file_name ,
20982105 protect_content = protect_content , message_thread_id = message_thread_id ))
@@ -2162,6 +2169,7 @@ def send_sticker(
21622169
21632170 if data and not (sticker ):
21642171 # function typo miss compatibility
2172+ logger .warning ('The parameter "data" is deprecated. Use "sticker" instead.' )
21652173 sticker = data
21662174
21672175 return types .Message .de_json (
@@ -2256,6 +2264,9 @@ def send_video(
22562264 :param has_spoiler: Pass True, if the video should be sent as a spoiler
22572265 :type has_spoiler: :obj:`bool`
22582266
2267+ :param thumb: Deprecated. Use thumbnail instead
2268+ :type thumb: :obj:`str` or :class:`telebot.types.InputFile`
2269+
22592270 :return: On success, the sent Message is returned.
22602271 :rtype: :class:`telebot.types.Message`
22612272 """
@@ -2266,11 +2277,12 @@ def send_video(
22662277
22672278 if data and not (video ):
22682279 # function typo miss compatibility
2280+ logger .warning ('The parameter "data" is deprecated. Use "video" instead.' )
22692281 video = data
22702282
22712283 if thumb is not None and thumbnail is None :
22722284 thumbnail = thumb
2273- logger .warning ('thumb is deprecated, use thumbnail instead' )
2285+ logger .warning ('The parameter " thumb" is deprecated. Use " thumbnail" instead. ' )
22742286
22752287 return types .Message .de_json (
22762288 apihelper .send_video (
@@ -2359,6 +2371,9 @@ def send_animation(
23592371 :param has_spoiler: Pass True, if the animation should be sent as a spoiler
23602372 :type has_spoiler: :obj:`bool`
23612373
2374+ :param thumb: Deprecated. Use thumbnail instead
2375+ :type thumb: :obj:`str` or :class:`telebot.types.InputFile`
2376+
23622377 :return: On success, the sent Message is returned.
23632378 :rtype: :class:`telebot.types.Message`
23642379 """
@@ -2438,6 +2453,8 @@ def send_video_note(
24382453 :param message_thread_id: Identifier of a message thread, in which the video note will be sent
24392454 :type message_thread_id: :obj:`int`
24402455
2456+ :param thumb: Deprecated. Use thumbnail instead
2457+ :type thumb: :obj:`str` or :class:`telebot.types.InputFile`
24412458 :return: On success, the sent Message is returned.
24422459 :rtype: :class:`telebot.types.Message`
24432460 """
@@ -3023,9 +3040,7 @@ def restrict_chat_member(
30233040 can_invite_users = can_invite_users ,
30243041 can_pin_messages = can_pin_messages
30253042 )
3026- logger .warning (
3027- "Individual parameters are deprecated and will be removed, use 'permissions' instead."
3028- )
3043+ logger .warning ('The parameters "can_..." are deprecated, use "permissions" instead.' )
30293044 return apihelper .restrict_chat_member (
30303045 self .token , chat_id , user_id , permissions , until_date , use_independent_chat_permissions )
30313046
@@ -3108,7 +3123,7 @@ def promote_chat_member(
31083123 :rtype: :obj:`bool`
31093124 """
31103125 if can_manage_voice_chats is not None :
3111- logger .warning ("promote_chat_member: can_manage_voice_chats parameter is deprecated. Use can_manage_video_chats instead." )
3126+ logger .warning ('The parameter "can_manage_voice_chats" is deprecated. Use " can_manage_video_chats" instead.' )
31123127 if can_manage_video_chats is None :
31133128 can_manage_video_chats = can_manage_voice_chats
31143129
@@ -4537,8 +4552,7 @@ def answer_callback_query(
45374552 """
45384553 return apihelper .answer_callback_query (self .token , callback_query_id , text , show_alert , url , cache_time )
45394554
4540- def set_sticker_set_thumbnail (
4541- self , name : str , user_id : int , thumb : Union [Any , str ]= None ):
4555+ def set_sticker_set_thumbnail (self , name : str , user_id : int , thumbnail : Union [Any , str ]= None ):
45424556 """
45434557 Use this method to set the thumbnail of a sticker set.
45444558 Animated thumbnails can be set for animated sticker sets only. Returns True on success.
@@ -4551,16 +4565,17 @@ def set_sticker_set_thumbnail(
45514565 :param user_id: User identifier
45524566 :type user_id: :obj:`int`
45534567
4554- :param thumb:
4555- :type thumb : :obj:`filelike object`
4568+ :param thumbnail: A .WEBP or .PNG image with the thumbnail, must be up to 128 kilobytes in size and have a width and height of exactly 100px, or a .TGS animation with a thumbnail up to 32 kilobytes in size (see https://core.telegram.org/stickers#animated-sticker-requirements for animated sticker technical requirements), or a WEBM video with the thumbnail up to 32 kilobytes in size; see https://core.telegram.org/stickers#video-sticker-requirements for video sticker technical requirements. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. More information on Sending Files ». Animated and video sticker set thumbnails can't be uploaded via HTTP URL. If omitted, then the thumbnail is dropped and the first sticker is used as the thumbnail.
4569+ :type thumbnail : :obj:`filelike object`
45564570
45574571 :return: On success, True is returned.
45584572 :rtype: :obj:`bool`
45594573 """
4560- return apihelper .set_sticker_set_thumb (self .token , name , user_id , thumb )
4574+
4575+ return apihelper .set_sticker_set_thumbnail (self .token , name , user_id , thumbnail )
45614576
4562- def set_sticker_set_thumb (
4563- self , name : str , user_id : int , thumb : Union [Any , str ]= None ):
4577+ @ util . deprecated ( deprecation_text = "Use set_sticker_set_thumbnail instead" )
4578+ def set_sticker_set_thumb ( self , name : str , user_id : int , thumb : Union [Any , str ]= None ):
45644579 """
45654580 Use this method to set the thumbnail of a sticker set.
45664581 Animated thumbnails can be set for animated sticker sets only. Returns True on success.
@@ -4580,8 +4595,7 @@ def set_sticker_set_thumb(
45804595 :rtype: :obj:`bool`
45814596 """
45824597 # deprecated
4583- logger .warning ('set_sticker_set_thumb is deprecated. Use set_sticker_set_thumbnail instead.' )
4584- return apihelper .set_sticker_set_thumb (self .token , name , user_id , thumb )
4598+ return self .set_sticker_set_thumbnail (name , user_id , thumb )
45854599
45864600 def get_sticker_set (self , name : str ) -> types .StickerSet :
45874601 """
@@ -4736,7 +4750,7 @@ def upload_sticker_file(self, user_id: int, png_sticker: Union[Any, str]=None, s
47364750 :rtype: :class:`telebot.types.File`
47374751 """
47384752 if png_sticker :
4739- logger .warning ("png_sticker is deprecated, use sticker instead" , DeprecationWarning )
4753+ logger .warning ('The parameter "png_sticker" is deprecated. Use " sticker" instead.' )
47404754 sticker = png_sticker
47414755 sticker_format = "static"
47424756
@@ -4894,10 +4908,7 @@ def add_sticker_to_set(
48944908 if sticker is None :
48954909 old_sticker = png_sticker or tgs_sticker or webm_sticker
48964910 if old_sticker is not None :
4897- logger .warning (
4898- 'The parameters "png_sticker", "tgs_sticker", "webm_sticker", "emojis" and "mask_position" are deprecated, '
4899- 'use "sticker" instead'
4900- )
4911+ logger .warning ('The parameters "..._sticker", "emojis" and "mask_position" are deprecated, use "sticker" instead' )
49014912 if not old_sticker :
49024913 raise ValueError ('You must pass at least one sticker.' )
49034914 sticker = types .InputSticker (old_sticker , emojis , mask_position )
@@ -6740,7 +6751,6 @@ def _run_middlewares_and_handler(self, message, handlers, middlewares, update_ty
67406751 if not process_handler : continue
67416752 for i in inspect .signature (handler ['function' ]).parameters :
67426753 params .append (i )
6743- result = None
67446754 if len (params ) == 1 :
67456755 result = handler ['function' ](message )
67466756 elif "data" in params :
0 commit comments