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

Renamed the field thumb in the classes Animation, Audio, Document, Sticker, Video, VideoNote, InputMediaAnimation, InputMediaAudio, InputMediaDocument, InputMediaVideo, StickerSet to thumbnail. Renamed the parameter thumb in the methods sendAnimation, sendAudio, sendDocument, sendVideo, sendVideoNote to thumbnail.

This commit is contained in:
coder2020official 2023-03-11 23:34:17 +04:00
parent 715aabaf49
commit 5c6b867582
5 changed files with 209 additions and 149 deletions

View File

@ -1837,11 +1837,12 @@ class TeleBot:
parse_mode: Optional[str]=None, parse_mode: Optional[str]=None,
disable_notification: Optional[bool]=None, disable_notification: Optional[bool]=None,
timeout: Optional[int]=None, timeout: Optional[int]=None,
thumb: Optional[Union[Any, str]]=None, thumbnail: Optional[Union[Any, str]]=None,
caption_entities: Optional[List[types.MessageEntity]]=None, caption_entities: Optional[List[types.MessageEntity]]=None,
allow_sending_without_reply: Optional[bool]=None, allow_sending_without_reply: Optional[bool]=None,
protect_content: Optional[bool]=None, protect_content: Optional[bool]=None,
message_thread_id: Optional[int]=None) -> types.Message: message_thread_id: Optional[int]=None,
thumb: Optional[Union[Any, str]]=None,) -> types.Message:
""" """
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 or .M4A format. On success, the sent Message is returned. Bots can currently send audio files of up to 50 MB in size, 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,
@ -1887,11 +1888,11 @@ class TeleBot:
:param timeout: Timeout in seconds for the request. :param timeout: Timeout in seconds for the request.
:type timeout: :obj:`int` :type timeout: :obj:`int`
:param thumb: Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. :param thumbnail: Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side.
The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320.
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, 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,
so you can pass attach://<file_attach_name> if the thumbnail was uploaded using multipart/form-data under <file_attach_name> so you can pass attach://<file_attach_name> if the thumbnail was uploaded using multipart/form-data under <file_attach_name>
:type thumb: :obj:`str` :type thumbnail: :obj:`str`
:param caption_entities: A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode :param caption_entities: A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode
:type caption_entities: :obj:`list` of :class:`telebot.types.MessageEntity` :type caption_entities: :obj:`list` of :class:`telebot.types.MessageEntity`
@ -1913,10 +1914,14 @@ class TeleBot:
protect_content = self.protect_content if (protect_content is None) else protect_content protect_content = self.protect_content if (protect_content is None) else protect_content
allow_sending_without_reply = self.allow_sending_without_reply if (allow_sending_without_reply is None) else allow_sending_without_reply allow_sending_without_reply = self.allow_sending_without_reply if (allow_sending_without_reply is None) else allow_sending_without_reply
if thumb is not None and thumbnail is None:
thumbnail = thumb
logger.warning('thumb is deprecated, use thumbnail instead')
return types.Message.de_json( return types.Message.de_json(
apihelper.send_audio( apihelper.send_audio(
self.token, chat_id, audio, caption, duration, performer, title, reply_to_message_id, self.token, chat_id, audio, caption, duration, performer, title, reply_to_message_id,
reply_markup, parse_mode, disable_notification, timeout, thumb, reply_markup, parse_mode, disable_notification, timeout, thumbnail,
caption_entities, allow_sending_without_reply, protect_content, message_thread_id)) caption_entities, allow_sending_without_reply, protect_content, message_thread_id))
# TODO: Rewrite this method like in API. # TODO: Rewrite this method like in API.
@ -2003,13 +2008,14 @@ class TeleBot:
parse_mode: Optional[str]=None, parse_mode: Optional[str]=None,
disable_notification: Optional[bool]=None, disable_notification: Optional[bool]=None,
timeout: Optional[int]=None, timeout: Optional[int]=None,
thumb: Optional[Union[Any, str]]=None, thumbnail: Optional[Union[Any, str]]=None,
caption_entities: Optional[List[types.MessageEntity]]=None, caption_entities: Optional[List[types.MessageEntity]]=None,
allow_sending_without_reply: Optional[bool]=None, allow_sending_without_reply: Optional[bool]=None,
visible_file_name: Optional[str]=None, visible_file_name: Optional[str]=None,
disable_content_type_detection: Optional[bool]=None, disable_content_type_detection: Optional[bool]=None,
data: Optional[Union[Any, str]]=None, data: Optional[Union[Any, str]]=None,
protect_content: Optional[bool]=None, message_thread_id: Optional[int]=None) -> types.Message: protect_content: Optional[bool]=None, message_thread_id: Optional[int]=None,
thumb: Optional[Union[Any, str]]=None,) -> types.Message:
""" """
Use this method to send general files. Use this method to send general files.
@ -2042,8 +2048,8 @@ class TeleBot:
:param timeout: Timeout in seconds for the request. :param timeout: Timeout in seconds for the request.
:type timeout: :obj:`int` :type timeout: :obj:`int`
:param thumb: InputFile or String : Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. 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, so you can pass attach://<file_attach_name> if the thumbnail was uploaded using multipart/form-data under <file_attach_name> :param thumbnail: InputFile or String : Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. 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, so you can pass attach://<file_attach_name> if the thumbnail was uploaded using multipart/form-data under <file_attach_name>
:type thumb: :obj:`str` or :class:`telebot.types.InputFile` :type thumbnail: :obj:`str` or :class:`telebot.types.InputFile`
:param caption_entities: A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode :param caption_entities: A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode
:type caption_entities: :obj:`list` of :class:`telebot.types.MessageEntity` :type caption_entities: :obj:`list` of :class:`telebot.types.MessageEntity`
@ -2078,11 +2084,15 @@ class TeleBot:
# function typo miss compatibility # function typo miss compatibility
document = data document = data
if thumb is not None and thumbnail is None:
thumbnail = thumb
logger.warning('thumb is deprecated, use thumbnail instead')
return types.Message.de_json( return types.Message.de_json(
apihelper.send_data( apihelper.send_data(
self.token, chat_id, document, 'document', self.token, chat_id, document, 'document',
reply_to_message_id = reply_to_message_id, reply_markup = reply_markup, parse_mode = parse_mode, 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 = thumb, disable_notification = disable_notification, timeout = timeout, caption = caption, thumb = thumbnail,
caption_entities = caption_entities, allow_sending_without_reply = allow_sending_without_reply, 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, disable_content_type_detection = disable_content_type_detection, visible_file_name = visible_file_name,
protect_content = protect_content, message_thread_id = message_thread_id)) protect_content = protect_content, message_thread_id = message_thread_id))
@ -2167,7 +2177,7 @@ class TeleBot:
duration: Optional[int]=None, duration: Optional[int]=None,
width: Optional[int]=None, width: Optional[int]=None,
height: Optional[int]=None, height: Optional[int]=None,
thumb: Optional[Union[Any, str]]=None, thumbnail: Optional[Union[Any, str]]=None,
caption: Optional[str]=None, caption: Optional[str]=None,
parse_mode: Optional[str]=None, parse_mode: Optional[str]=None,
caption_entities: Optional[List[types.MessageEntity]]=None, caption_entities: Optional[List[types.MessageEntity]]=None,
@ -2180,7 +2190,8 @@ class TeleBot:
timeout: Optional[int]=None, timeout: Optional[int]=None,
data: Optional[Union[Any, str]]=None, data: Optional[Union[Any, str]]=None,
message_thread_id: Optional[int]=None, message_thread_id: Optional[int]=None,
has_spoiler: Optional[bool]=None) -> types.Message: has_spoiler: Optional[bool]=None,
thumb: Optional[Union[Any, str]]=None,) -> types.Message:
""" """
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).
@ -2201,8 +2212,8 @@ class TeleBot:
:param height: Video height :param height: Video height
:type height: :obj:`int` :type height: :obj:`int`
:param thumb: Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. 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, so you can pass attach://<file_attach_name> if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. :param thumbnail: Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. 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, so you can pass attach://<file_attach_name> if the thumbnail was uploaded using multipart/form-data under <file_attach_name>.
:type thumb: :obj:`str` or :class:`telebot.types.InputFile` :type thumbnail: :obj:`str` or :class:`telebot.types.InputFile`
:param caption: Video caption (may also be used when resending videos by file_id), 0-1024 characters after entities parsing :param caption: Video caption (may also be used when resending videos by file_id), 0-1024 characters after entities parsing
:type caption: :obj:`str` :type caption: :obj:`str`
@ -2257,10 +2268,14 @@ class TeleBot:
# function typo miss compatibility # function typo miss compatibility
video = data video = data
if thumb is not None and thumbnail is None:
thumbnail = thumb
logger.warning('thumb is deprecated, use thumbnail instead')
return types.Message.de_json( return types.Message.de_json(
apihelper.send_video( apihelper.send_video(
self.token, chat_id, video, duration, caption, reply_to_message_id, reply_markup, self.token, chat_id, video, duration, caption, reply_to_message_id, reply_markup,
parse_mode, supports_streaming, disable_notification, timeout, thumb, width, height, parse_mode, supports_streaming, disable_notification, timeout, thumbnail, width, height,
caption_entities, allow_sending_without_reply, protect_content, message_thread_id, has_spoiler)) caption_entities, allow_sending_without_reply, protect_content, message_thread_id, has_spoiler))
def send_animation( def send_animation(
@ -2268,7 +2283,7 @@ class TeleBot:
duration: Optional[int]=None, duration: Optional[int]=None,
width: Optional[int]=None, width: Optional[int]=None,
height: Optional[int]=None, height: Optional[int]=None,
thumb: Optional[Union[Any, str]]=None, thumbnail: Optional[Union[Any, str]]=None,
caption: Optional[str]=None, caption: Optional[str]=None,
parse_mode: Optional[str]=None, parse_mode: Optional[str]=None,
caption_entities: Optional[List[types.MessageEntity]]=None, caption_entities: Optional[List[types.MessageEntity]]=None,
@ -2279,7 +2294,8 @@ class TeleBot:
reply_markup: Optional[REPLY_MARKUP_TYPES]=None, reply_markup: Optional[REPLY_MARKUP_TYPES]=None,
timeout: Optional[int]=None, timeout: Optional[int]=None,
message_thread_id: Optional[int]=None, message_thread_id: Optional[int]=None,
has_spoiler: Optional[bool]=None) -> types.Message: has_spoiler: Optional[bool]=None,
thumb: Optional[Union[Any, str]]=None,) -> types.Message:
""" """
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).
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. 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.
@ -2302,11 +2318,11 @@ class TeleBot:
:param height: Animation height :param height: Animation height
:type height: :obj:`int` :type height: :obj:`int`
:param thumb: Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. :param thumbnail: Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side.
The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320.
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, 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,
so you can pass attach://<file_attach_name> if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. so you can pass attach://<file_attach_name> if the thumbnail was uploaded using multipart/form-data under <file_attach_name>.
:type thumb: :obj:`str` or :class:`telebot.types.InputFile` :type thumbnail: :obj:`str` or :class:`telebot.types.InputFile`
:param caption: Animation caption (may also be used when resending animation by file_id), 0-1024 characters after entities parsing :param caption: Animation caption (may also be used when resending animation by file_id), 0-1024 characters after entities parsing
:type caption: :obj:`str` :type caption: :obj:`str`
@ -2351,10 +2367,13 @@ class TeleBot:
protect_content = self.protect_content if (protect_content is None) else protect_content protect_content = self.protect_content if (protect_content is None) else protect_content
allow_sending_without_reply = self.allow_sending_without_reply if (allow_sending_without_reply is None) else allow_sending_without_reply allow_sending_without_reply = self.allow_sending_without_reply if (allow_sending_without_reply is None) else allow_sending_without_reply
if thumbnail is None and thumb is not None:
thumbnail = thumb
logger.warning('The parameter "thumb" is deprecated. Use "thumbnail" instead.')
return types.Message.de_json( return types.Message.de_json(
apihelper.send_animation( apihelper.send_animation(
self.token, chat_id, animation, duration, caption, reply_to_message_id, self.token, chat_id, animation, duration, caption, reply_to_message_id,
reply_markup, parse_mode, disable_notification, timeout, thumb, reply_markup, parse_mode, disable_notification, timeout, thumbnail,
caption_entities, allow_sending_without_reply, protect_content, width, height, message_thread_id, has_spoiler)) caption_entities, allow_sending_without_reply, protect_content, width, height, message_thread_id, has_spoiler))
# TODO: Rewrite this method like in API. # TODO: Rewrite this method like in API.
@ -2366,10 +2385,11 @@ class TeleBot:
reply_markup: Optional[REPLY_MARKUP_TYPES]=None, reply_markup: Optional[REPLY_MARKUP_TYPES]=None,
disable_notification: Optional[bool]=None, disable_notification: Optional[bool]=None,
timeout: Optional[int]=None, timeout: Optional[int]=None,
thumb: Optional[Union[Any, str]]=None, thumbnail: Optional[Union[Any, str]]=None,
allow_sending_without_reply: Optional[bool]=None, allow_sending_without_reply: Optional[bool]=None,
protect_content: Optional[bool]=None, protect_content: Optional[bool]=None,
message_thread_id: Optional[int]=None) -> types.Message: message_thread_id: Optional[int]=None,
thumb: Optional[Union[Any, str]]=None) -> types.Message:
""" """
As of v.4.0, Telegram clients support rounded square MPEG4 videos of up to 1 minute long. As of v.4.0, Telegram clients support rounded square MPEG4 videos of up to 1 minute long.
Use this method to send video messages. On success, the sent Message is returned. Use this method to send video messages. On success, the sent Message is returned.
@ -2403,11 +2423,11 @@ class TeleBot:
:param timeout: Timeout in seconds for the request. :param timeout: Timeout in seconds for the request.
:type timeout: :obj:`int` :type timeout: :obj:`int`
:param thumb: Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. :param thumbnail: Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side.
The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320.
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, 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,
so you can pass attach://<file_attach_name> if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. so you can pass attach://<file_attach_name> if the thumbnail was uploaded using multipart/form-data under <file_attach_name>.
:type thumb: :obj:`str` or :class:`telebot.types.InputFile` :type thumbnail: :obj:`str` or :class:`telebot.types.InputFile`
: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
:type allow_sending_without_reply: :obj:`bool` :type allow_sending_without_reply: :obj:`bool`
@ -2425,10 +2445,14 @@ class TeleBot:
protect_content = self.protect_content if (protect_content is None) else protect_content protect_content = self.protect_content if (protect_content is None) else protect_content
allow_sending_without_reply = self.allow_sending_without_reply if (allow_sending_without_reply is None) else allow_sending_without_reply allow_sending_without_reply = self.allow_sending_without_reply if (allow_sending_without_reply is None) else allow_sending_without_reply
if thumbnail is None and thumb is not None:
thumbnail = thumb
logger.warning('The parameter "thumb" is deprecated. Use "thumbnail" instead.')
return types.Message.de_json( return types.Message.de_json(
apihelper.send_video_note( apihelper.send_video_note(
self.token, chat_id, data, duration, length, reply_to_message_id, reply_markup, self.token, chat_id, data, duration, length, reply_to_message_id, reply_markup,
disable_notification, timeout, thumb, allow_sending_without_reply, protect_content, message_thread_id)) disable_notification, timeout, thumbnail, allow_sending_without_reply, protect_content, message_thread_id))
def send_media_group( def send_media_group(

View File

@ -697,11 +697,11 @@ def send_video(token, chat_id, data, duration=None, caption=None, reply_to_messa
if thumb: if thumb:
if not util.is_string(thumb): if not util.is_string(thumb):
if files: if files:
files['thumb'] = thumb files['thumbnail'] = thumb
else: else:
files = {'thumb': thumb} files = {'thumbnail': thumb}
else: else:
payload['thumb'] = thumb payload['thumbnail'] = thumb
if width: if width:
payload['width'] = width payload['width'] = width
if height: if height:
@ -748,11 +748,11 @@ def send_animation(
if thumb: if thumb:
if not util.is_string(thumb): if not util.is_string(thumb):
if files: if files:
files['thumb'] = thumb files['thumbnail'] = thumb
else: else:
files = {'thumb': thumb} files = {'thumbnail': thumb}
else: else:
payload['thumb'] = thumb payload['thumbnail'] = thumb
if caption_entities: if caption_entities:
payload['caption_entities'] = json.dumps(types.MessageEntity.to_list_of_dicts(caption_entities)) payload['caption_entities'] = json.dumps(types.MessageEntity.to_list_of_dicts(caption_entities))
if allow_sending_without_reply is not None: if allow_sending_without_reply is not None:
@ -832,11 +832,11 @@ def send_video_note(token, chat_id, data, duration=None, length=None, reply_to_m
if thumb: if thumb:
if not util.is_string(thumb): if not util.is_string(thumb):
if files: if files:
files['thumb'] = thumb files['thumbnail'] = thumb
else: else:
files = {'thumb': thumb} files = {'thumbnail': thumb}
else: else:
payload['thumb'] = thumb payload['thumbnail'] = thumb
if allow_sending_without_reply is not None: if allow_sending_without_reply is not None:
payload['allow_sending_without_reply'] = allow_sending_without_reply payload['allow_sending_without_reply'] = allow_sending_without_reply
if protect_content is not None: if protect_content is not None:
@ -877,11 +877,11 @@ def send_audio(token, chat_id, audio, caption=None, duration=None, performer=Non
if thumb: if thumb:
if not util.is_string(thumb): if not util.is_string(thumb):
if files: if files:
files['thumb'] = thumb files['thumbnail'] = thumb
else: else:
files = {'thumb': thumb} files = {'thumbnail': thumb}
else: else:
payload['thumb'] = thumb payload['thumbnail'] = thumb
if caption_entities: if caption_entities:
payload['caption_entities'] = json.dumps(types.MessageEntity.to_list_of_dicts(caption_entities)) payload['caption_entities'] = json.dumps(types.MessageEntity.to_list_of_dicts(caption_entities))
if allow_sending_without_reply is not None: if allow_sending_without_reply is not None:
@ -922,11 +922,11 @@ def send_data(token, chat_id, data, data_type, reply_to_message_id=None, reply_m
if thumb: if thumb:
if not util.is_string(thumb): if not util.is_string(thumb):
if files: if files:
files['thumb'] = thumb files['thumbnail'] = thumb
else: else:
files = {'thumb': thumb} files = {'thumbnail': thumb}
else: else:
payload['thumb'] = thumb payload['thumbnail'] = thumb
if caption_entities: if caption_entities:
payload['caption_entities'] = json.dumps(types.MessageEntity.to_list_of_dicts(caption_entities)) payload['caption_entities'] = json.dumps(types.MessageEntity.to_list_of_dicts(caption_entities))
if allow_sending_without_reply is not None: if allow_sending_without_reply is not None:

View File

@ -2700,11 +2700,12 @@ class AsyncTeleBot:
parse_mode: Optional[str]=None, parse_mode: Optional[str]=None,
disable_notification: Optional[bool]=None, disable_notification: Optional[bool]=None,
timeout: Optional[int]=None, timeout: Optional[int]=None,
thumb: Optional[Union[Any, str]]=None, thumbnail: Optional[Union[Any, str]]=None,
caption_entities: Optional[List[types.MessageEntity]]=None, caption_entities: Optional[List[types.MessageEntity]]=None,
allow_sending_without_reply: Optional[bool]=None, allow_sending_without_reply: Optional[bool]=None,
protect_content: Optional[bool]=None, protect_content: Optional[bool]=None,
message_thread_id: Optional[int]=None) -> types.Message: message_thread_id: Optional[int]=None,
thumb: Optional[Union[Any, str]]=None) -> types.Message:
""" """
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 or .M4A format. On success, the sent Message is returned. Bots can currently send audio files of up to 50 MB in size, 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,
@ -2750,11 +2751,11 @@ class AsyncTeleBot:
:param timeout: Timeout in seconds for the request. :param timeout: Timeout in seconds for the request.
:type timeout: :obj:`int` :type timeout: :obj:`int`
:param thumb: Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. :param thumbnail: Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side.
The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320.
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, 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,
so you can pass attach://<file_attach_name> if the thumbnail was uploaded using multipart/form-data under <file_attach_name> so you can pass attach://<file_attach_name> if the thumbnail was uploaded using multipart/form-data under <file_attach_name>
:type thumb: :obj:`str` :type thumbnail: :obj:`str`
:param caption_entities: A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode :param caption_entities: A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode
:type caption_entities: :obj:`list` of :class:`telebot.types.MessageEntity` :type caption_entities: :obj:`list` of :class:`telebot.types.MessageEntity`
@ -2776,10 +2777,14 @@ class AsyncTeleBot:
protect_content = self.protect_content if (protect_content is None) else protect_content protect_content = self.protect_content if (protect_content is None) else protect_content
allow_sending_without_reply = self.allow_sending_without_reply if (allow_sending_without_reply is None) else allow_sending_without_reply allow_sending_without_reply = self.allow_sending_without_reply if (allow_sending_without_reply is None) else allow_sending_without_reply
if thumb is not None and thumbnail is None:
thumbnail = thumb
logger.warning('The parameter "thumb" is deprecated, use "thumbnail" instead')
return types.Message.de_json( return types.Message.de_json(
await asyncio_helper.send_audio( await asyncio_helper.send_audio(
self.token, chat_id, audio, caption, duration, performer, title, reply_to_message_id, self.token, chat_id, audio, caption, duration, performer, title, reply_to_message_id,
reply_markup, parse_mode, disable_notification, timeout, thumb, reply_markup, parse_mode, disable_notification, timeout, thumbnail,
caption_entities, allow_sending_without_reply, protect_content, message_thread_id)) caption_entities, allow_sending_without_reply, protect_content, message_thread_id))
async def send_voice( async def send_voice(
@ -2864,14 +2869,15 @@ class AsyncTeleBot:
parse_mode: Optional[str]=None, parse_mode: Optional[str]=None,
disable_notification: Optional[bool]=None, disable_notification: Optional[bool]=None,
timeout: Optional[int]=None, timeout: Optional[int]=None,
thumb: Optional[Union[Any, str]]=None, thumbnail: Optional[Union[Any, str]]=None,
caption_entities: Optional[List[types.MessageEntity]]=None, caption_entities: Optional[List[types.MessageEntity]]=None,
allow_sending_without_reply: Optional[bool]=None, allow_sending_without_reply: Optional[bool]=None,
visible_file_name: Optional[str]=None, visible_file_name: Optional[str]=None,
disable_content_type_detection: Optional[bool]=None, disable_content_type_detection: Optional[bool]=None,
data: Optional[Union[Any, str]]=None, data: Optional[Union[Any, str]]=None,
protect_content: Optional[bool]=None, protect_content: Optional[bool]=None,
message_thread_id: Optional[int]=None) -> types.Message: message_thread_id: Optional[int]=None,
thumb: Optional[Union[Any, str]]=None) -> types.Message:
""" """
Use this method to send general files. Use this method to send general files.
@ -2904,8 +2910,8 @@ class AsyncTeleBot:
:param timeout: Timeout in seconds for the request. :param timeout: Timeout in seconds for the request.
:type timeout: :obj:`int` :type timeout: :obj:`int`
:param thumb: InputFile or String : Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. 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, so you can pass attach://<file_attach_name> if the thumbnail was uploaded using multipart/form-data under <file_attach_name> :param thumbnail: InputFile or String : Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. 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, so you can pass attach://<file_attach_name> if the thumbnail was uploaded using multipart/form-data under <file_attach_name>
:type thumb: :obj:`str` or :class:`telebot.types.InputFile` :type thumbnail: :obj:`str` or :class:`telebot.types.InputFile`
:param caption_entities: A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode :param caption_entities: A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode
:type caption_entities: :obj:`list` of :class:`telebot.types.MessageEntity` :type caption_entities: :obj:`list` of :class:`telebot.types.MessageEntity`
@ -2940,11 +2946,15 @@ class AsyncTeleBot:
# function typo miss compatibility # function typo miss compatibility
document = data document = data
if thumb is not None and thumbnail is None:
thumbnail = thumb
logger.warning('thumb is deprecated, use thumbnail instead')
return types.Message.de_json( return types.Message.de_json(
await asyncio_helper.send_data( await asyncio_helper.send_data(
self.token, chat_id, document, 'document', self.token, chat_id, document, 'document',
reply_to_message_id = reply_to_message_id, reply_markup = reply_markup, parse_mode = parse_mode, 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 = thumb, disable_notification = disable_notification, timeout = timeout, caption = caption, thumb = thumbnail,
caption_entities = caption_entities, allow_sending_without_reply = allow_sending_without_reply, 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, disable_content_type_detection = disable_content_type_detection, visible_file_name = visible_file_name, protect_content = protect_content,
message_thread_id = message_thread_id)) message_thread_id = message_thread_id))
@ -3027,7 +3037,7 @@ class AsyncTeleBot:
duration: Optional[int]=None, duration: Optional[int]=None,
width: Optional[int]=None, width: Optional[int]=None,
height: Optional[int]=None, height: Optional[int]=None,
thumb: Optional[Union[Any, str]]=None, thumbnail: Optional[Union[Any, str]]=None,
caption: Optional[str]=None, caption: Optional[str]=None,
parse_mode: Optional[str]=None, parse_mode: Optional[str]=None,
caption_entities: Optional[List[types.MessageEntity]]=None, caption_entities: Optional[List[types.MessageEntity]]=None,
@ -3040,7 +3050,8 @@ class AsyncTeleBot:
timeout: Optional[int]=None, timeout: Optional[int]=None,
data: Optional[Union[Any, str]]=None, data: Optional[Union[Any, str]]=None,
message_thread_id: Optional[int]=None, message_thread_id: Optional[int]=None,
has_spoiler: Optional[bool]=None) -> types.Message: has_spoiler: Optional[bool]=None,
thumb: Optional[Union[Any, str]]=None) -> types.Message:
""" """
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).
@ -3061,8 +3072,8 @@ class AsyncTeleBot:
:param height: Video height :param height: Video height
:type height: :obj:`int` :type height: :obj:`int`
:param thumb: Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. 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, so you can pass attach://<file_attach_name> if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. :param thumbnail: Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. 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, so you can pass attach://<file_attach_name> if the thumbnail was uploaded using multipart/form-data under <file_attach_name>.
:type thumb: :obj:`str` or :class:`telebot.types.InputFile` :type thumbnail: :obj:`str` or :class:`telebot.types.InputFile`
:param caption: Video caption (may also be used when resending videos by file_id), 0-1024 characters after entities parsing :param caption: Video caption (may also be used when resending videos by file_id), 0-1024 characters after entities parsing
:type caption: :obj:`str` :type caption: :obj:`str`
@ -3118,10 +3129,14 @@ class AsyncTeleBot:
logger.warning("send_sticker: data parameter is deprecated. Use video instead.") logger.warning("send_sticker: data parameter is deprecated. Use video instead.")
video = data video = data
if thumb and not(thumbnail):
logger.warning("send_sticker: thumb parameter is deprecated. Use thumbnail instead.")
thumbnail = thumb
return types.Message.de_json( return types.Message.de_json(
await asyncio_helper.send_video( await asyncio_helper.send_video(
self.token, chat_id, video, duration, caption, reply_to_message_id, reply_markup, self.token, chat_id, video, duration, caption, reply_to_message_id, reply_markup,
parse_mode, supports_streaming, disable_notification, timeout, thumb, width, height, parse_mode, supports_streaming, disable_notification, timeout, thumbnail, width, height,
caption_entities, allow_sending_without_reply, protect_content, message_thread_id, has_spoiler)) caption_entities, allow_sending_without_reply, protect_content, message_thread_id, has_spoiler))
async def send_animation( async def send_animation(
@ -3129,7 +3144,7 @@ class AsyncTeleBot:
duration: Optional[int]=None, duration: Optional[int]=None,
width: Optional[int]=None, width: Optional[int]=None,
height: Optional[int]=None, height: Optional[int]=None,
thumb: Optional[Union[Any, str]]=None, thumbnail: Optional[Union[Any, str]]=None,
caption: Optional[str]=None, caption: Optional[str]=None,
parse_mode: Optional[str]=None, parse_mode: Optional[str]=None,
caption_entities: Optional[List[types.MessageEntity]]=None, caption_entities: Optional[List[types.MessageEntity]]=None,
@ -3140,7 +3155,8 @@ class AsyncTeleBot:
reply_markup: Optional[REPLY_MARKUP_TYPES]=None, reply_markup: Optional[REPLY_MARKUP_TYPES]=None,
timeout: Optional[int]=None, timeout: Optional[int]=None,
message_thread_id: Optional[int]=None, message_thread_id: Optional[int]=None,
has_spoiler: Optional[bool]=None) -> types.Message: has_spoiler: Optional[bool]=None,
thumb: Optional[Union[Any, str]]=None) -> types.Message:
""" """
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).
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. 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.
@ -3163,11 +3179,11 @@ class AsyncTeleBot:
:param height: Animation height :param height: Animation height
:type height: :obj:`int` :type height: :obj:`int`
:param thumb: Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. :param thumbnail: Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side.
The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320.
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, 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,
so you can pass attach://<file_attach_name> if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. so you can pass attach://<file_attach_name> if the thumbnail was uploaded using multipart/form-data under <file_attach_name>.
:type thumb: :obj:`str` or :class:`telebot.types.InputFile` :type thumbnail: :obj:`str` or :class:`telebot.types.InputFile`
:param caption: Animation caption (may also be used when resending animation by file_id), 0-1024 characters after entities parsing :param caption: Animation caption (may also be used when resending animation by file_id), 0-1024 characters after entities parsing
:type caption: :obj:`str` :type caption: :obj:`str`
@ -3212,10 +3228,14 @@ class AsyncTeleBot:
protect_content = self.protect_content if (protect_content is None) else protect_content protect_content = self.protect_content if (protect_content is None) else protect_content
allow_sending_without_reply = self.allow_sending_without_reply if (allow_sending_without_reply is None) else allow_sending_without_reply allow_sending_without_reply = self.allow_sending_without_reply if (allow_sending_without_reply is None) else allow_sending_without_reply
if thumb is not None and thumbnail is None:
thumbnail = thumb
logger.warning('thumb is deprecated, use thumbnail instead')
return types.Message.de_json( return types.Message.de_json(
await asyncio_helper.send_animation( await asyncio_helper.send_animation(
self.token, chat_id, animation, duration, caption, reply_to_message_id, self.token, chat_id, animation, duration, caption, reply_to_message_id,
reply_markup, parse_mode, disable_notification, timeout, thumb, reply_markup, parse_mode, disable_notification, timeout, thumbnail,
caption_entities, allow_sending_without_reply, width, height, protect_content, message_thread_id, has_spoiler)) caption_entities, allow_sending_without_reply, width, height, protect_content, message_thread_id, has_spoiler))
async def send_video_note( async def send_video_note(
@ -3226,10 +3246,11 @@ class AsyncTeleBot:
reply_markup: Optional[REPLY_MARKUP_TYPES]=None, reply_markup: Optional[REPLY_MARKUP_TYPES]=None,
disable_notification: Optional[bool]=None, disable_notification: Optional[bool]=None,
timeout: Optional[int]=None, timeout: Optional[int]=None,
thumb: Optional[Union[Any, str]]=None, thumbnail: Optional[Union[Any, str]]=None,
allow_sending_without_reply: Optional[bool]=None, allow_sending_without_reply: Optional[bool]=None,
protect_content: Optional[bool]=None, protect_content: Optional[bool]=None,
message_thread_id: Optional[int]=None) -> types.Message: message_thread_id: Optional[int]=None,
thumb: Optional[Union[Any, str]]=None) -> types.Message:
""" """
As of v.4.0, Telegram clients support rounded square MPEG4 videos of up to 1 minute long. As of v.4.0, Telegram clients support rounded square MPEG4 videos of up to 1 minute long.
Use this method to send video messages. On success, the sent Message is returned. Use this method to send video messages. On success, the sent Message is returned.
@ -3263,11 +3284,11 @@ class AsyncTeleBot:
:param timeout: Timeout in seconds for the request. :param timeout: Timeout in seconds for the request.
:type timeout: :obj:`int` :type timeout: :obj:`int`
:param thumb: Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. :param thumbnail: Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side.
The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320.
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, 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,
so you can pass attach://<file_attach_name> if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. so you can pass attach://<file_attach_name> if the thumbnail was uploaded using multipart/form-data under <file_attach_name>.
:type thumb: :obj:`str` or :class:`telebot.types.InputFile` :type thumbnail: :obj:`str` or :class:`telebot.types.InputFile`
: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
:type allow_sending_without_reply: :obj:`bool` :type allow_sending_without_reply: :obj:`bool`
@ -3285,10 +3306,14 @@ class AsyncTeleBot:
protect_content = self.protect_content if (protect_content is None) else protect_content protect_content = self.protect_content if (protect_content is None) else protect_content
allow_sending_without_reply = self.allow_sending_without_reply if (allow_sending_without_reply is None) else allow_sending_without_reply allow_sending_without_reply = self.allow_sending_without_reply if (allow_sending_without_reply is None) else allow_sending_without_reply
if thumb is not None and thumbnail is None:
thumbnail = thumb
logger.warning('thumb is deprecated, use thumbnail instead')
return types.Message.de_json( return types.Message.de_json(
await asyncio_helper.send_video_note( await asyncio_helper.send_video_note(
self.token, chat_id, data, duration, length, reply_to_message_id, reply_markup, self.token, chat_id, data, duration, length, reply_to_message_id, reply_markup,
disable_notification, timeout, thumb, allow_sending_without_reply, protect_content, message_thread_id)) disable_notification, timeout, thumbnail, allow_sending_without_reply, protect_content, message_thread_id))
async def send_media_group( async def send_media_group(
self, chat_id: Union[int, str], self, chat_id: Union[int, str],

View File

@ -689,11 +689,11 @@ async def send_video(token, chat_id, data, duration=None, caption=None, reply_to
if thumb: if thumb:
if not util.is_string(thumb): if not util.is_string(thumb):
if files: if files:
files['thumb'] = thumb files['thumbnail'] = thumb
else: else:
files = {'thumb': thumb} files = {'thumbnail': thumb}
else: else:
payload['thumb'] = thumb payload['thumbnail'] = thumb
if width: if width:
payload['width'] = width payload['width'] = width
if height: if height:
@ -740,11 +740,11 @@ async def send_animation(
if thumb: if thumb:
if not util.is_string(thumb): if not util.is_string(thumb):
if files: if files:
files['thumb'] = thumb files['thumbnail'] = thumb
else: else:
files = {'thumb': thumb} files = {'thumbnail': thumb}
else: else:
payload['thumb'] = thumb payload['thumbnail'] = thumb
if caption_entities: if caption_entities:
payload['caption_entities'] = json.dumps(types.MessageEntity.to_list_of_dicts(caption_entities)) payload['caption_entities'] = json.dumps(types.MessageEntity.to_list_of_dicts(caption_entities))
if allow_sending_without_reply is not None: if allow_sending_without_reply is not None:
@ -824,11 +824,11 @@ async def send_video_note(token, chat_id, data, duration=None, length=None, repl
if thumb: if thumb:
if not util.is_string(thumb): if not util.is_string(thumb):
if files: if files:
files['thumb'] = thumb files['thumbnail'] = thumb
else: else:
files = {'thumb': thumb} files = {'thumbnail': thumb}
else: else:
payload['thumb'] = thumb payload['thumbnail'] = thumb
if allow_sending_without_reply is not None: if allow_sending_without_reply is not None:
payload['allow_sending_without_reply'] = allow_sending_without_reply payload['allow_sending_without_reply'] = allow_sending_without_reply
if protect_content is not None: if protect_content is not None:
@ -869,11 +869,11 @@ async def send_audio(token, chat_id, audio, caption=None, duration=None, perform
if thumb: if thumb:
if not util.is_string(thumb): if not util.is_string(thumb):
if files: if files:
files['thumb'] = thumb files['thumbnail'] = thumb
else: else:
files = {'thumb': thumb} files = {'thumbnail': thumb}
else: else:
payload['thumb'] = thumb payload['thumbnail'] = thumb
if caption_entities: if caption_entities:
payload['caption_entities'] = json.dumps(types.MessageEntity.to_list_of_dicts(caption_entities)) payload['caption_entities'] = json.dumps(types.MessageEntity.to_list_of_dicts(caption_entities))
if allow_sending_without_reply is not None: if allow_sending_without_reply is not None:
@ -914,11 +914,11 @@ async def send_data(token, chat_id, data, data_type, reply_to_message_id=None, r
if thumb: if thumb:
if not util.is_string(thumb): if not util.is_string(thumb):
if files: if files:
files['thumb'] = thumb files['thumbnail'] = thumb
else: else:
files = {'thumb': thumb} files = {'thumbnail': thumb}
else: else:
payload['thumb'] = thumb payload['thumbnail'] = thumb
if caption_entities: if caption_entities:
payload['caption_entities'] = json.dumps(types.MessageEntity.to_list_of_dicts(caption_entities)) payload['caption_entities'] = json.dumps(types.MessageEntity.to_list_of_dicts(caption_entities))
if allow_sending_without_reply is not None: if allow_sending_without_reply is not None:

View File

@ -1552,8 +1552,8 @@ class Audio(JsonDeserializable):
double-precision float type are safe for storing this value. double-precision float type are safe for storing this value.
:type file_size: :obj:`int` :type file_size: :obj:`int`
:param thumb: Optional. Thumbnail of the album cover to which the music file belongs :param thumbnail: Optional. Thumbnail of the album cover to which the music file belongs
:type thumb: :class:`telebot.types.PhotoSize` :type thumbnail: :class:`telebot.types.PhotoSize`
:return: Instance of the class :return: Instance of the class
:rtype: :class:`telebot.types.Audio` :rtype: :class:`telebot.types.Audio`
@ -1562,14 +1562,14 @@ class Audio(JsonDeserializable):
def de_json(cls, json_string): def de_json(cls, json_string):
if json_string is None: return None if json_string is None: return None
obj = cls.check_json(json_string) obj = cls.check_json(json_string)
if 'thumb' in obj and 'file_id' in obj['thumb']: if 'thumbnail' in obj and 'file_id' in obj['thumbnail']:
obj['thumb'] = PhotoSize.de_json(obj['thumb']) obj['thumbnail'] = PhotoSize.de_json(obj['thumbnail'])
else: else:
obj['thumb'] = None obj['thumbnail'] = None
return cls(**obj) return cls(**obj)
def __init__(self, file_id, file_unique_id, duration, performer=None, title=None, file_name=None, mime_type=None, def __init__(self, file_id, file_unique_id, duration, performer=None, title=None, file_name=None, mime_type=None,
file_size=None, thumb=None, **kwargs): file_size=None, thumbnail=None, **kwargs):
self.file_id: str = file_id self.file_id: str = file_id
self.file_unique_id: str = file_unique_id self.file_unique_id: str = file_unique_id
self.duration: int = duration self.duration: int = duration
@ -1578,7 +1578,8 @@ class Audio(JsonDeserializable):
self.file_name: str = file_name self.file_name: str = file_name
self.mime_type: str = mime_type self.mime_type: str = mime_type
self.file_size: int = file_size self.file_size: int = file_size
self.thumb: PhotoSize = thumb self.thumbnail: PhotoSize = thumbnail
self.thumb = thumbnail
class Voice(JsonDeserializable): class Voice(JsonDeserializable):
@ -1635,8 +1636,8 @@ class Document(JsonDeserializable):
bots. Can't be used to download or reuse the file. bots. Can't be used to download or reuse the file.
:type file_unique_id: :obj:`str` :type file_unique_id: :obj:`str`
:param thumb: Optional. Document thumbnail as defined by sender :param thumbnail: Optional. Document thumbnail as defined by sender
:type thumb: :class:`telebot.types.PhotoSize` :type thumbnail: :class:`telebot.types.PhotoSize`
:param file_name: Optional. Original filename as defined by sender :param file_name: Optional. Original filename as defined by sender
:type file_name: :obj:`str` :type file_name: :obj:`str`
@ -1656,19 +1657,20 @@ class Document(JsonDeserializable):
def de_json(cls, json_string): def de_json(cls, json_string):
if json_string is None: return None if json_string is None: return None
obj = cls.check_json(json_string) obj = cls.check_json(json_string)
if 'thumb' in obj and 'file_id' in obj['thumb']: if 'thumbnail' in obj and 'file_id' in obj['thumbnail']:
obj['thumb'] = PhotoSize.de_json(obj['thumb']) obj['thumbnail'] = PhotoSize.de_json(obj['thumbnail'])
else: else:
obj['thumb'] = None obj['thumbnail'] = None
return cls(**obj) return cls(**obj)
def __init__(self, file_id, file_unique_id, thumb=None, file_name=None, mime_type=None, file_size=None, **kwargs): def __init__(self, file_id, file_unique_id, thumbnail=None, file_name=None, mime_type=None, file_size=None, **kwargs):
self.file_id: str = file_id self.file_id: str = file_id
self.file_unique_id: str = file_unique_id self.file_unique_id: str = file_unique_id
self.thumb: PhotoSize = thumb self.thumbnail: PhotoSize = thumbnail
self.file_name: str = file_name self.file_name: str = file_name
self.mime_type: str = mime_type self.mime_type: str = mime_type
self.file_size: int = file_size self.file_size: int = file_size
self.thumb = thumbnail
class Video(JsonDeserializable): class Video(JsonDeserializable):
@ -1693,8 +1695,8 @@ class Video(JsonDeserializable):
:param duration: Duration of the video in seconds as defined by sender :param duration: Duration of the video in seconds as defined by sender
:type duration: :obj:`int` :type duration: :obj:`int`
:param thumb: Optional. Video thumbnail :param thumbnail: Optional. Video thumbnail
:type thumb: :class:`telebot.types.PhotoSize` :type thumbnail: :class:`telebot.types.PhotoSize`
:param file_name: Optional. Original filename as defined by sender :param file_name: Optional. Original filename as defined by sender
:type file_name: :obj:`str` :type file_name: :obj:`str`
@ -1714,20 +1716,21 @@ class Video(JsonDeserializable):
def de_json(cls, json_string): def de_json(cls, json_string):
if json_string is None: return None if json_string is None: return None
obj = cls.check_json(json_string) obj = cls.check_json(json_string)
if 'thumb' in obj and 'file_id' in obj['thumb']: if 'thumbnail' in obj and 'file_id' in obj['thumbnail']:
obj['thumb'] = PhotoSize.de_json(obj['thumb']) obj['thumbnail'] = PhotoSize.de_json(obj['thumbnail'])
return cls(**obj) return cls(**obj)
def __init__(self, file_id, file_unique_id, width, height, duration, thumb=None, file_name=None, mime_type=None, file_size=None, **kwargs): def __init__(self, file_id, file_unique_id, width, height, duration, thumbnail=None, file_name=None, mime_type=None, file_size=None, **kwargs):
self.file_id: str = file_id self.file_id: str = file_id
self.file_unique_id: str = file_unique_id self.file_unique_id: str = file_unique_id
self.width: int = width self.width: int = width
self.height: int = height self.height: int = height
self.duration: int = duration self.duration: int = duration
self.thumb: PhotoSize = thumb self.thumbnail: PhotoSize = thumbnail
self.file_name: str = file_name self.file_name: str = file_name
self.mime_type: str = mime_type self.mime_type: str = mime_type
self.file_size: int = file_size self.file_size: int = file_size
self.thumb = thumbnail
class VideoNote(JsonDeserializable): class VideoNote(JsonDeserializable):
@ -1749,8 +1752,8 @@ class VideoNote(JsonDeserializable):
:param duration: Duration of the video in seconds as defined by sender :param duration: Duration of the video in seconds as defined by sender
:type duration: :obj:`int` :type duration: :obj:`int`
:param thumb: Optional. Video thumbnail :param thumbnail: Optional. Video thumbnail
:type thumb: :class:`telebot.types.PhotoSize` :type thumbnail: :class:`telebot.types.PhotoSize`
:param file_size: Optional. File size in bytes :param file_size: Optional. File size in bytes
:type file_size: :obj:`int` :type file_size: :obj:`int`
@ -1762,17 +1765,18 @@ class VideoNote(JsonDeserializable):
def de_json(cls, json_string): def de_json(cls, json_string):
if json_string is None: return None if json_string is None: return None
obj = cls.check_json(json_string) obj = cls.check_json(json_string)
if 'thumb' in obj and 'file_id' in obj['thumb']: if 'thumbnail' in obj and 'file_id' in obj['thumbnail']:
obj['thumb'] = PhotoSize.de_json(obj['thumb']) obj['thumbnail'] = PhotoSize.de_json(obj['thumbnail'])
return cls(**obj) return cls(**obj)
def __init__(self, file_id, file_unique_id, length, duration, thumb=None, file_size=None, **kwargs): def __init__(self, file_id, file_unique_id, length, duration, thumbnail=None, file_size=None, **kwargs):
self.file_id: str = file_id self.file_id: str = file_id
self.file_unique_id: str = file_unique_id self.file_unique_id: str = file_unique_id
self.length: int = length self.length: int = length
self.duration: int = duration self.duration: int = duration
self.thumb: PhotoSize = thumb self.thumbnail: PhotoSize = thumbnail
self.file_size: int = file_size self.file_size: int = file_size
self.thumb = thumbnail
class Contact(JsonDeserializable): class Contact(JsonDeserializable):
@ -5389,8 +5393,8 @@ class Animation(JsonDeserializable):
:param duration: Duration of the video in seconds as defined by sender :param duration: Duration of the video in seconds as defined by sender
:type duration: :obj:`int` :type duration: :obj:`int`
:param thumb: Optional. Animation thumbnail as defined by sender :param thumbnail: Optional. Animation thumbnail as defined by sender
:type thumb: :class:`telebot.types.PhotoSize` :type thumbnail: :class:`telebot.types.PhotoSize`
:param file_name: Optional. Original animation filename as defined by sender :param file_name: Optional. Original animation filename as defined by sender
:type file_name: :obj:`str` :type file_name: :obj:`str`
@ -5410,20 +5414,21 @@ class Animation(JsonDeserializable):
def de_json(cls, json_string): def de_json(cls, json_string):
if (json_string is None): return None if (json_string is None): return None
obj = cls.check_json(json_string) obj = cls.check_json(json_string)
if 'thumb' in obj and 'file_id' in obj['thumb']: if 'thumbnail' in obj and 'file_id' in obj['thumbnail']:
obj["thumb"] = PhotoSize.de_json(obj['thumb']) obj["thumbnail"] = PhotoSize.de_json(obj['thumbnail'])
else: else:
obj['thumb'] = None obj['thumbnail'] = None
return cls(**obj) return cls(**obj)
def __init__(self, file_id, file_unique_id, width=None, height=None, duration=None, def __init__(self, file_id, file_unique_id, width=None, height=None, duration=None,
thumb=None, file_name=None, mime_type=None, file_size=None, **kwargs): thumbnail=None, file_name=None, mime_type=None, file_size=None, **kwargs):
self.file_id: str = file_id self.file_id: str = file_id
self.file_unique_id: str = file_unique_id self.file_unique_id: str = file_unique_id
self.width: int = width self.width: int = width
self.height: int = height self.height: int = height
self.duration: int = duration self.duration: int = duration
self.thumb: PhotoSize = thumb self.thumbnail: PhotoSize = thumbnail
self.thumb: PhotoSize = thumbnail
self.file_name: str = file_name self.file_name: str = file_name
self.mime_type: str = mime_type self.mime_type: str = mime_type
self.file_size: int = file_size self.file_size: int = file_size
@ -5819,8 +5824,8 @@ class StickerSet(JsonDeserializable):
:param stickers: List of all set stickers :param stickers: List of all set stickers
:type stickers: :obj:`list` of :class:`telebot.types.Sticker` :type stickers: :obj:`list` of :class:`telebot.types.Sticker`
:param thumb: Optional. Sticker set thumbnail in the .WEBP, .TGS, or .WEBM format :param thumbnail: Optional. Sticker set thumbnail in the .WEBP, .TGS, or .WEBM format
:type thumb: :class:`telebot.types.PhotoSize` :type thumbnail: :class:`telebot.types.PhotoSize`
:return: Instance of the class :return: Instance of the class
:rtype: :class:`telebot.types.StickerSet` :rtype: :class:`telebot.types.StickerSet`
@ -5833,20 +5838,21 @@ class StickerSet(JsonDeserializable):
for s in obj['stickers']: for s in obj['stickers']:
stickers.append(Sticker.de_json(s)) stickers.append(Sticker.de_json(s))
obj['stickers'] = stickers obj['stickers'] = stickers
if 'thumb' in obj and 'file_id' in obj['thumb']: if 'thumbnail' in obj and 'file_id' in obj['thumbnail']:
obj['thumb'] = PhotoSize.de_json(obj['thumb']) obj['thumbnail'] = PhotoSize.de_json(obj['thumbnail'])
else: else:
obj['thumb'] = None obj['thumbnail'] = None
return cls(**obj) return cls(**obj)
def __init__(self, name, title, sticker_type, is_animated, is_video, stickers, thumb=None, **kwargs): def __init__(self, name, title, sticker_type, is_animated, is_video, stickers, thumbnail=None, **kwargs):
self.name: str = name self.name: str = name
self.title: str = title self.title: str = title
self.sticker_type: str = sticker_type self.sticker_type: str = sticker_type
self.is_animated: bool = is_animated self.is_animated: bool = is_animated
self.is_video: bool = is_video self.is_video: bool = is_video
self.stickers: List[Sticker] = stickers self.stickers: List[Sticker] = stickers
self.thumb: PhotoSize = thumb self.thumbnail: PhotoSize = thumbnail
self.thumb = thumbnail
@property @property
def contains_masks(self): def contains_masks(self):
@ -5886,8 +5892,8 @@ class Sticker(JsonDeserializable):
:param is_video: True, if the sticker is a video sticker :param is_video: True, if the sticker is a video sticker
:type is_video: :obj:`bool` :type is_video: :obj:`bool`
:param thumb: Optional. Sticker thumbnail in the .WEBP or .JPG format :param thumbnail: Optional. Sticker thumbnail in the .WEBP or .JPG format
:type thumb: :class:`telebot.types.PhotoSize` :type thumbnail: :class:`telebot.types.PhotoSize`
:param emoji: Optional. Emoji associated with the sticker :param emoji: Optional. Emoji associated with the sticker
:type emoji: :obj:`str` :type emoji: :obj:`str`
@ -5920,10 +5926,10 @@ class Sticker(JsonDeserializable):
def de_json(cls, json_string): def de_json(cls, json_string):
if (json_string is None): return None if (json_string is None): return None
obj = cls.check_json(json_string) obj = cls.check_json(json_string)
if 'thumb' in obj and 'file_id' in obj['thumb']: if 'thumbnail' in obj and 'file_id' in obj['thumbnail']:
obj['thumb'] = PhotoSize.de_json(obj['thumb']) obj['thumbnail'] = PhotoSize.de_json(obj['thumbnail'])
else: else:
obj['thumb'] = None obj['thumbnail'] = None
if 'mask_position' in obj: if 'mask_position' in obj:
obj['mask_position'] = MaskPosition.de_json(obj['mask_position']) obj['mask_position'] = MaskPosition.de_json(obj['mask_position'])
if 'premium_animation' in obj: if 'premium_animation' in obj:
@ -5931,7 +5937,7 @@ class Sticker(JsonDeserializable):
return cls(**obj) return cls(**obj)
def __init__(self, file_id, file_unique_id, type, width, height, is_animated, def __init__(self, file_id, file_unique_id, type, width, height, is_animated,
is_video, thumb=None, emoji=None, set_name=None, mask_position=None, file_size=None, is_video, thumbnail=None, emoji=None, set_name=None, mask_position=None, file_size=None,
premium_animation=None, custom_emoji_id=None, needs_repainting=None ,**kwargs): premium_animation=None, custom_emoji_id=None, needs_repainting=None ,**kwargs):
self.file_id: str = file_id self.file_id: str = file_id
self.file_unique_id: str = file_unique_id self.file_unique_id: str = file_unique_id
@ -5940,7 +5946,7 @@ class Sticker(JsonDeserializable):
self.height: int = height self.height: int = height
self.is_animated: bool = is_animated self.is_animated: bool = is_animated
self.is_video: bool = is_video self.is_video: bool = is_video
self.thumb: PhotoSize = thumb self.thumbnail: PhotoSize = thumbnail
self.emoji: str = emoji self.emoji: str = emoji
self.set_name: str = set_name self.set_name: str = set_name
self.mask_position: MaskPosition = mask_position self.mask_position: MaskPosition = mask_position
@ -5948,6 +5954,7 @@ class Sticker(JsonDeserializable):
self.premium_animation: File = premium_animation self.premium_animation: File = premium_animation
self.custom_emoji_id: int = custom_emoji_id self.custom_emoji_id: int = custom_emoji_id
self.needs_repainting: bool = needs_repainting self.needs_repainting: bool = needs_repainting
self.thumb = self.thumbnail
@ -6099,12 +6106,12 @@ class InputMediaVideo(InputMedia):
multipart/form-data under <file_attach_name> name. More information on Sending Files » multipart/form-data under <file_attach_name> name. More information on Sending Files »
:type media: :obj:`str` :type media: :obj:`str`
:param thumb: Optional. Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported :param thumbnail: Optional. Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported
server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should
not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be not exceed 320. 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, so you can pass attach://<file_attach_name> if the thumbnail was uploaded using only uploaded as a new file, so you can pass attach://<file_attach_name> if the thumbnail was uploaded using
multipart/form-data under <file_attach_name>. More information on Sending Files » multipart/form-data under <file_attach_name>. More information on Sending Files »
:type thumb: InputFile or :obj:`str` :type thumbnail: InputFile or :obj:`str`
:param caption: Optional. Caption of the video to be sent, 0-1024 characters after entities parsing :param caption: Optional. Caption of the video to be sent, 0-1024 characters after entities parsing
:type caption: :obj:`str` :type caption: :obj:`str`
@ -6135,21 +6142,22 @@ class InputMediaVideo(InputMedia):
:return: Instance of the class :return: Instance of the class
:rtype: :class:`telebot.types.InputMediaVideo` :rtype: :class:`telebot.types.InputMediaVideo`
""" """
def __init__(self, media, thumb=None, caption=None, parse_mode=None, caption_entities=None, def __init__(self, media, thumbnail=None, caption=None, parse_mode=None, caption_entities=None,
width=None, height=None, duration=None, supports_streaming=None, has_spoiler=None): width=None, height=None, duration=None, supports_streaming=None, has_spoiler=None):
super(InputMediaVideo, self).__init__( super(InputMediaVideo, self).__init__(
type="video", media=media, caption=caption, parse_mode=parse_mode, caption_entities=caption_entities) type="video", media=media, caption=caption, parse_mode=parse_mode, caption_entities=caption_entities)
self.thumb = thumb self.thumbnail = thumbnail
self.width = width self.width = width
self.height = height self.height = height
self.duration = duration self.duration = duration
self.supports_streaming = supports_streaming self.supports_streaming = supports_streaming
self.has_spoiler: Optional[bool] = has_spoiler self.has_spoiler: Optional[bool] = has_spoiler
self.thumb = thumbnail
def to_dict(self): def to_dict(self):
ret = super(InputMediaVideo, self).to_dict() ret = super(InputMediaVideo, self).to_dict()
if self.thumb: if self.thumbnail:
ret['thumb'] = self.thumb ret['thumbnail'] = self.thumbnail
if self.width: if self.width:
ret['width'] = self.width ret['width'] = self.width
if self.height: if self.height:
@ -6207,20 +6215,21 @@ class InputMediaAnimation(InputMedia):
:return: Instance of the class :return: Instance of the class
:rtype: :class:`telebot.types.InputMediaAnimation` :rtype: :class:`telebot.types.InputMediaAnimation`
""" """
def __init__(self, media, thumb=None, caption=None, parse_mode=None, caption_entities=None, def __init__(self, media, thumbnail=None, caption=None, parse_mode=None, caption_entities=None,
width=None, height=None, duration=None, has_spoiler=None): width=None, height=None, duration=None, has_spoiler=None):
super(InputMediaAnimation, self).__init__( super(InputMediaAnimation, self).__init__(
type="animation", media=media, caption=caption, parse_mode=parse_mode, caption_entities=caption_entities) type="animation", media=media, caption=caption, parse_mode=parse_mode, caption_entities=caption_entities)
self.thumb = thumb self.thumbnail = thumbnail
self.width = width self.width = width
self.height = height self.height = height
self.duration = duration self.duration = duration
self.has_spoiler: Optional[bool] = has_spoiler self.has_spoiler: Optional[bool] = has_spoiler
self.thumb = thumbnail
def to_dict(self): def to_dict(self):
ret = super(InputMediaAnimation, self).to_dict() ret = super(InputMediaAnimation, self).to_dict()
if self.thumb: if self.thumbnail:
ret['thumb'] = self.thumb ret['thumbnail'] = self.thumbnail
if self.width: if self.width:
ret['width'] = self.width ret['width'] = self.width
if self.height: if self.height:
@ -6243,12 +6252,12 @@ class InputMediaAudio(InputMedia):
multipart/form-data under <file_attach_name> name. More information on Sending Files » multipart/form-data under <file_attach_name> name. More information on Sending Files »
:type media: :obj:`str` :type media: :obj:`str`
:param thumb: Optional. Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported :param thumbnail: Optional. Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported
server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should
not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be not exceed 320. 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, so you can pass attach://<file_attach_name> if the thumbnail was uploaded using only uploaded as a new file, so you can pass attach://<file_attach_name> if the thumbnail was uploaded using
multipart/form-data under <file_attach_name>. More information on Sending Files » multipart/form-data under <file_attach_name>. More information on Sending Files »
:type thumb: InputFile or :obj:`str` :type thumbnail: InputFile or :obj:`str`
:param caption: Optional. Caption of the audio to be sent, 0-1024 characters after entities parsing :param caption: Optional. Caption of the audio to be sent, 0-1024 characters after entities parsing
:type caption: :obj:`str` :type caption: :obj:`str`
@ -6273,19 +6282,20 @@ class InputMediaAudio(InputMedia):
:return: Instance of the class :return: Instance of the class
:rtype: :class:`telebot.types.InputMediaAudio` :rtype: :class:`telebot.types.InputMediaAudio`
""" """
def __init__(self, media, thumb=None, caption=None, parse_mode=None, caption_entities=None, def __init__(self, media, thumbnail=None, caption=None, parse_mode=None, caption_entities=None,
duration=None, performer=None, title=None): duration=None, performer=None, title=None):
super(InputMediaAudio, self).__init__( super(InputMediaAudio, self).__init__(
type="audio", media=media, caption=caption, parse_mode=parse_mode, caption_entities=caption_entities) type="audio", media=media, caption=caption, parse_mode=parse_mode, caption_entities=caption_entities)
self.thumb = thumb self.thumbnail = thumbnail
self.duration = duration self.duration = duration
self.performer = performer self.performer = performer
self.title = title self.title = title
self.thumb = thumbnail
def to_dict(self): def to_dict(self):
ret = super(InputMediaAudio, self).to_dict() ret = super(InputMediaAudio, self).to_dict()
if self.thumb: if self.thumbnail:
ret['thumb'] = self.thumb ret['thumbnail'] = self.thumbnail
if self.duration: if self.duration:
ret['duration'] = self.duration ret['duration'] = self.duration
if self.performer: if self.performer:
@ -6306,12 +6316,12 @@ class InputMediaDocument(InputMedia):
multipart/form-data under <file_attach_name> name. More information on Sending Files » multipart/form-data under <file_attach_name> name. More information on Sending Files »
:type media: :obj:`str` :type media: :obj:`str`
:param thumb: Optional. Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported :param thumbnail: Optional. Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported
server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should
not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be not exceed 320. 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, so you can pass attach://<file_attach_name> if the thumbnail was uploaded using only uploaded as a new file, so you can pass attach://<file_attach_name> if the thumbnail was uploaded using
multipart/form-data under <file_attach_name>. More information on Sending Files » multipart/form-data under <file_attach_name>. More information on Sending Files »
:type thumb: InputFile or :obj:`str` :type thumbnail: InputFile or :obj:`str`
:param caption: Optional. Caption of the document to be sent, 0-1024 characters after entities parsing :param caption: Optional. Caption of the document to be sent, 0-1024 characters after entities parsing
:type caption: :obj:`str` :type caption: :obj:`str`
@ -6331,17 +6341,18 @@ class InputMediaDocument(InputMedia):
:return: Instance of the class :return: Instance of the class
:rtype: :class:`telebot.types.InputMediaDocument` :rtype: :class:`telebot.types.InputMediaDocument`
""" """
def __init__(self, media, thumb=None, caption=None, parse_mode=None, caption_entities=None, def __init__(self, media, thumbnail=None, caption=None, parse_mode=None, caption_entities=None,
disable_content_type_detection=None): disable_content_type_detection=None):
super(InputMediaDocument, self).__init__( super(InputMediaDocument, self).__init__(
type="document", media=media, caption=caption, parse_mode=parse_mode, caption_entities=caption_entities) type="document", media=media, caption=caption, parse_mode=parse_mode, caption_entities=caption_entities)
self.thumb = thumb self.thumbnail = thumbnail
self.disable_content_type_detection = disable_content_type_detection self.disable_content_type_detection = disable_content_type_detection
self.thumb = thumbnail
def to_dict(self): def to_dict(self):
ret = super(InputMediaDocument, self).to_dict() ret = super(InputMediaDocument, self).to_dict()
if self.thumb: if self.thumbnail:
ret['thumb'] = self.thumb ret['thumbnail'] = self.thumbnail
if self.disable_content_type_detection is not None: if self.disable_content_type_detection is not None:
ret['disable_content_type_detection'] = self.disable_content_type_detection ret['disable_content_type_detection'] = self.disable_content_type_detection
return ret return ret