From e56c60ac00ebec7bf0d35a496191b1fdda8a9096 Mon Sep 17 00:00:00 2001 From: Badiboy Date: Sat, 25 Mar 2023 14:44:50 +0300 Subject: [PATCH] thumb deprecation typo and thumb->thumbnail param rename --- telebot/__init__.py | 8 ++--- telebot/apihelper.py | 62 ++++++++++++++++----------------- telebot/async_telebot.py | 8 ++--- telebot/asyncio_helper.py | 72 +++++++++++++++++++-------------------- 4 files changed, 75 insertions(+), 75 deletions(-) diff --git a/telebot/__init__.py b/telebot/__init__.py index 43a462c..dd1f8d2 100644 --- a/telebot/__init__.py +++ b/telebot/__init__.py @@ -1918,7 +1918,7 @@ class TeleBot: if thumb is not None and thumbnail is None: thumbnail = thumb - logger.warning('thumb is deprecated, use thumbnail instead') + logger.warning('"thumb" param is deprecated, use "thumbnail" param instead') return types.Message.de_json( apihelper.send_audio( @@ -2090,13 +2090,13 @@ class TeleBot: if thumb is not None and thumbnail is None: thumbnail = thumb - logger.warning('thumb is deprecated, use thumbnail instead') + logger.warning('"thumb" param is deprecated, use "thumbnail" param instead') return types.Message.de_json( apihelper.send_data( self.token, chat_id, document, 'document', reply_to_message_id = reply_to_message_id, reply_markup = reply_markup, parse_mode = parse_mode, - disable_notification = disable_notification, timeout = timeout, caption = caption, thumb = thumbnail, + disable_notification = disable_notification, timeout = timeout, caption = caption, thumbnail= thumbnail, caption_entities = caption_entities, allow_sending_without_reply = allow_sending_without_reply, disable_content_type_detection = disable_content_type_detection, visible_file_name = visible_file_name, protect_content = protect_content, message_thread_id = message_thread_id)) @@ -2276,7 +2276,7 @@ class TeleBot: if thumb is not None and thumbnail is None: thumbnail = thumb - logger.warning('thumb is deprecated, use thumbnail instead') + logger.warning('"thumb" param is deprecated, use "thumbnail" param instead') return types.Message.de_json( apihelper.send_video( diff --git a/telebot/apihelper.py b/telebot/apihelper.py index 88b36f9..32e38bc 100644 --- a/telebot/apihelper.py +++ b/telebot/apihelper.py @@ -668,8 +668,8 @@ def send_chat_action(token, chat_id, action, timeout=None, message_thread_id=Non def send_video(token, chat_id, data, duration=None, caption=None, reply_to_message_id=None, reply_markup=None, - parse_mode=None, supports_streaming=None, disable_notification=None, timeout=None, - thumb=None, width=None, height=None, caption_entities=None, allow_sending_without_reply=None, protect_content=None, + parse_mode=None, supports_streaming=None, disable_notification=None, timeout=None, + thumbnail=None, width=None, height=None, caption_entities=None, allow_sending_without_reply=None, protect_content=None, message_thread_id=None, has_spoiler=None): method_url = r'sendVideo' payload = {'chat_id': chat_id} @@ -694,14 +694,14 @@ def send_video(token, chat_id, data, duration=None, caption=None, reply_to_messa payload['disable_notification'] = disable_notification if timeout: payload['timeout'] = timeout - if thumb: - if not util.is_string(thumb): + if thumbnail: + if not util.is_string(thumbnail): if files: - files['thumbnail'] = thumb + files['thumbnail'] = thumbnail else: - files = {'thumbnail': thumb} + files = {'thumbnail': thumbnail} else: - payload['thumbnail'] = thumb + payload['thumbnail'] = thumbnail if width: payload['width'] = width if height: @@ -721,7 +721,7 @@ def send_video(token, chat_id, data, duration=None, caption=None, reply_to_messa def send_animation( token, chat_id, data, duration=None, caption=None, reply_to_message_id=None, reply_markup=None, - parse_mode=None, disable_notification=None, timeout=None, thumb=None, caption_entities=None, + parse_mode=None, disable_notification=None, timeout=None, thumbnail=None, caption_entities=None, allow_sending_without_reply=None, protect_content=None, width=None, height=None, message_thread_id=None, has_spoiler=None): method_url = r'sendAnimation' @@ -745,14 +745,14 @@ def send_animation( payload['disable_notification'] = disable_notification if timeout: payload['timeout'] = timeout - if thumb: - if not util.is_string(thumb): + if thumbnail: + if not util.is_string(thumbnail): if files: - files['thumbnail'] = thumb + files['thumbnail'] = thumbnail else: - files = {'thumbnail': thumb} + files = {'thumbnail': thumbnail} else: - payload['thumbnail'] = thumb + payload['thumbnail'] = thumbnail if caption_entities: payload['caption_entities'] = json.dumps(types.MessageEntity.to_list_of_dicts(caption_entities)) if allow_sending_without_reply is not None: @@ -806,7 +806,7 @@ def send_voice(token, chat_id, voice, caption=None, duration=None, reply_to_mess def send_video_note(token, chat_id, data, duration=None, length=None, reply_to_message_id=None, reply_markup=None, - disable_notification=None, timeout=None, thumb=None, allow_sending_without_reply=None, protect_content=None, + disable_notification=None, timeout=None, thumbnail=None, allow_sending_without_reply=None, protect_content=None, message_thread_id=None): method_url = r'sendVideoNote' payload = {'chat_id': chat_id} @@ -829,14 +829,14 @@ def send_video_note(token, chat_id, data, duration=None, length=None, reply_to_m payload['disable_notification'] = disable_notification if timeout: payload['timeout'] = timeout - if thumb: - if not util.is_string(thumb): + if thumbnail: + if not util.is_string(thumbnail): if files: - files['thumbnail'] = thumb + files['thumbnail'] = thumbnail else: - files = {'thumbnail': thumb} + files = {'thumbnail': thumbnail} else: - payload['thumbnail'] = thumb + payload['thumbnail'] = thumbnail if allow_sending_without_reply is not None: payload['allow_sending_without_reply'] = allow_sending_without_reply if protect_content is not None: @@ -847,7 +847,7 @@ def send_video_note(token, chat_id, data, duration=None, length=None, reply_to_m def send_audio(token, chat_id, audio, caption=None, duration=None, performer=None, title=None, reply_to_message_id=None, - reply_markup=None, parse_mode=None, disable_notification=None, timeout=None, thumb=None, + reply_markup=None, parse_mode=None, disable_notification=None, timeout=None, thumbnail=None, caption_entities=None, allow_sending_without_reply=None, protect_content=None, message_thread_id=None): method_url = r'sendAudio' payload = {'chat_id': chat_id} @@ -874,14 +874,14 @@ def send_audio(token, chat_id, audio, caption=None, duration=None, performer=Non payload['disable_notification'] = disable_notification if timeout: payload['timeout'] = timeout - if thumb: - if not util.is_string(thumb): + if thumbnail: + if not util.is_string(thumbnail): if files: - files['thumbnail'] = thumb + files['thumbnail'] = thumbnail else: - files = {'thumbnail': thumb} + files = {'thumbnail': thumbnail} else: - payload['thumbnail'] = thumb + payload['thumbnail'] = thumbnail if caption_entities: payload['caption_entities'] = json.dumps(types.MessageEntity.to_list_of_dicts(caption_entities)) if allow_sending_without_reply is not None: @@ -894,7 +894,7 @@ def send_audio(token, chat_id, audio, caption=None, duration=None, performer=Non def send_data(token, chat_id, data, data_type, reply_to_message_id=None, reply_markup=None, parse_mode=None, - disable_notification=None, timeout=None, caption=None, thumb=None, caption_entities=None, + disable_notification=None, timeout=None, caption=None, thumbnail=None, caption_entities=None, allow_sending_without_reply=None, disable_content_type_detection=None, visible_file_name=None, protect_content = None, message_thread_id=None, emoji=None): method_url = get_method_by_type(data_type) @@ -919,14 +919,14 @@ def send_data(token, chat_id, data, data_type, reply_to_message_id=None, reply_m payload['timeout'] = timeout if caption: payload['caption'] = caption - if thumb: - if not util.is_string(thumb): + if thumbnail: + if not util.is_string(thumbnail): if files: - files['thumbnail'] = thumb + files['thumbnail'] = thumbnail else: - files = {'thumbnail': thumb} + files = {'thumbnail': thumbnail} else: - payload['thumbnail'] = thumb + payload['thumbnail'] = thumbnail if caption_entities: payload['caption_entities'] = json.dumps(types.MessageEntity.to_list_of_dicts(caption_entities)) if allow_sending_without_reply is not None: diff --git a/telebot/async_telebot.py b/telebot/async_telebot.py index 2e0af51..cd952ae 100644 --- a/telebot/async_telebot.py +++ b/telebot/async_telebot.py @@ -2948,13 +2948,13 @@ class AsyncTeleBot: if thumb is not None and thumbnail is None: thumbnail = thumb - logger.warning('thumb is deprecated, use thumbnail instead') + logger.warning('"thumb" param is deprecated, use "thumbnail" param instead') return types.Message.de_json( await asyncio_helper.send_data( self.token, chat_id, document, 'document', reply_to_message_id = reply_to_message_id, reply_markup = reply_markup, parse_mode = parse_mode, - disable_notification = disable_notification, timeout = timeout, caption = caption, thumb = thumbnail, + disable_notification = disable_notification, timeout = timeout, caption = caption, thumbnail= thumbnail, caption_entities = caption_entities, allow_sending_without_reply = allow_sending_without_reply, disable_content_type_detection = disable_content_type_detection, visible_file_name = visible_file_name, protect_content = protect_content, message_thread_id = message_thread_id)) @@ -3234,7 +3234,7 @@ class AsyncTeleBot: if thumb is not None and thumbnail is None: thumbnail = thumb - logger.warning('thumb is deprecated, use thumbnail instead') + logger.warning('"thumb" param is deprecated, use "thumbnail" param instead') return types.Message.de_json( await asyncio_helper.send_animation( @@ -3314,7 +3314,7 @@ class AsyncTeleBot: if thumb is not None and thumbnail is None: thumbnail = thumb - logger.warning('thumb is deprecated, use thumbnail instead') + logger.warning('"thumb" param is deprecated, use "thumbnail" param instead') return types.Message.de_json( await asyncio_helper.send_video_note( diff --git a/telebot/asyncio_helper.py b/telebot/asyncio_helper.py index 49dc92d..dc8e9b8 100644 --- a/telebot/asyncio_helper.py +++ b/telebot/asyncio_helper.py @@ -662,9 +662,9 @@ async def send_chat_action(token, chat_id, action, timeout=None, message_thread_ async def send_video(token, chat_id, data, duration=None, caption=None, reply_to_message_id=None, reply_markup=None, - parse_mode=None, supports_streaming=None, disable_notification=None, timeout=None, - thumb=None, width=None, height=None, caption_entities=None, allow_sending_without_reply=None, - protect_content=None, message_thread_id=None, has_spoiler=None): + parse_mode=None, supports_streaming=None, disable_notification=None, timeout=None, + thumbnail=None, width=None, height=None, caption_entities=None, allow_sending_without_reply=None, + protect_content=None, message_thread_id=None, has_spoiler=None): method_url = r'sendVideo' payload = {'chat_id': chat_id} files = None @@ -688,14 +688,14 @@ async def send_video(token, chat_id, data, duration=None, caption=None, reply_to payload['disable_notification'] = disable_notification if timeout: payload['timeout'] = timeout - if thumb: - if not util.is_string(thumb): + if thumbnail: + if not util.is_string(thumbnail): if files: - files['thumbnail'] = thumb + files['thumbnail'] = thumbnail else: - files = {'thumbnail': thumb} + files = {'thumbnail': thumbnail} else: - payload['thumbnail'] = thumb + payload['thumbnail'] = thumbnail if width: payload['width'] = width if height: @@ -715,7 +715,7 @@ async def send_video(token, chat_id, data, duration=None, caption=None, reply_to async def send_animation( token, chat_id, data, duration=None, caption=None, reply_to_message_id=None, reply_markup=None, - parse_mode=None, disable_notification=None, timeout=None, thumb=None, caption_entities=None, + parse_mode=None, disable_notification=None, timeout=None, thumbnail=None, caption_entities=None, allow_sending_without_reply=None, width=None, height=None, protect_content=None, message_thread_id=None, has_spoiler=None): method_url = r'sendAnimation' @@ -739,14 +739,14 @@ async def send_animation( payload['disable_notification'] = disable_notification if timeout: payload['timeout'] = timeout - if thumb: - if not util.is_string(thumb): + if thumbnail: + if not util.is_string(thumbnail): if files: - files['thumbnail'] = thumb + files['thumbnail'] = thumbnail else: - files = {'thumbnail': thumb} + files = {'thumbnail': thumbnail} else: - payload['thumbnail'] = thumb + payload['thumbnail'] = thumbnail if caption_entities: payload['caption_entities'] = json.dumps(types.MessageEntity.to_list_of_dicts(caption_entities)) if allow_sending_without_reply is not None: @@ -800,8 +800,8 @@ async def send_voice(token, chat_id, voice, caption=None, duration=None, reply_t async def send_video_note(token, chat_id, data, duration=None, length=None, reply_to_message_id=None, reply_markup=None, - disable_notification=None, timeout=None, thumb=None, allow_sending_without_reply=None, protect_content=None, - message_thread_id=None): + disable_notification=None, timeout=None, thumbnail=None, allow_sending_without_reply=None, protect_content=None, + message_thread_id=None): method_url = r'sendVideoNote' payload = {'chat_id': chat_id} files = None @@ -823,14 +823,14 @@ async def send_video_note(token, chat_id, data, duration=None, length=None, repl payload['disable_notification'] = disable_notification if timeout: payload['timeout'] = timeout - if thumb: - if not util.is_string(thumb): + if thumbnail: + if not util.is_string(thumbnail): if files: - files['thumbnail'] = thumb + files['thumbnail'] = thumbnail else: - files = {'thumbnail': thumb} + files = {'thumbnail': thumbnail} else: - payload['thumbnail'] = thumb + payload['thumbnail'] = thumbnail if allow_sending_without_reply is not None: payload['allow_sending_without_reply'] = allow_sending_without_reply if protect_content is not None: @@ -841,8 +841,8 @@ async def send_video_note(token, chat_id, data, duration=None, length=None, repl async def send_audio(token, chat_id, audio, caption=None, duration=None, performer=None, title=None, reply_to_message_id=None, - reply_markup=None, parse_mode=None, disable_notification=None, timeout=None, thumb=None, - caption_entities=None, allow_sending_without_reply=None, protect_content=None, message_thread_id=None): + reply_markup=None, parse_mode=None, disable_notification=None, timeout=None, thumbnail=None, + caption_entities=None, allow_sending_without_reply=None, protect_content=None, message_thread_id=None): method_url = r'sendAudio' payload = {'chat_id': chat_id} files = None @@ -868,14 +868,14 @@ async def send_audio(token, chat_id, audio, caption=None, duration=None, perform payload['disable_notification'] = disable_notification if timeout: payload['timeout'] = timeout - if thumb: - if not util.is_string(thumb): + if thumbnail: + if not util.is_string(thumbnail): if files: - files['thumbnail'] = thumb + files['thumbnail'] = thumbnail else: - files = {'thumbnail': thumb} + files = {'thumbnail': thumbnail} else: - payload['thumbnail'] = thumb + payload['thumbnail'] = thumbnail if caption_entities: payload['caption_entities'] = json.dumps(types.MessageEntity.to_list_of_dicts(caption_entities)) if allow_sending_without_reply is not None: @@ -888,9 +888,9 @@ async def send_audio(token, chat_id, audio, caption=None, duration=None, perform async def send_data(token, chat_id, data, data_type, reply_to_message_id=None, reply_markup=None, parse_mode=None, - disable_notification=None, timeout=None, caption=None, thumb=None, caption_entities=None, - allow_sending_without_reply=None, disable_content_type_detection=None, visible_file_name=None, protect_content=None, - message_thread_id=None, emoji=None): + disable_notification=None, timeout=None, caption=None, thumbnail=None, caption_entities=None, + allow_sending_without_reply=None, disable_content_type_detection=None, visible_file_name=None, protect_content=None, + message_thread_id=None, emoji=None): method_url = await get_method_by_type(data_type) payload = {'chat_id': chat_id} files = None @@ -913,14 +913,14 @@ async def send_data(token, chat_id, data, data_type, reply_to_message_id=None, r payload['timeout'] = timeout if caption: payload['caption'] = caption - if thumb: - if not util.is_string(thumb): + if thumbnail: + if not util.is_string(thumbnail): if files: - files['thumbnail'] = thumb + files['thumbnail'] = thumbnail else: - files = {'thumbnail': thumb} + files = {'thumbnail': thumbnail} else: - payload['thumbnail'] = thumb + payload['thumbnail'] = thumbnail if caption_entities: payload['caption_entities'] = json.dumps(types.MessageEntity.to_list_of_dicts(caption_entities)) if allow_sending_without_reply is not None: