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,
disable_notification: Optional[bool]=None,
timeout: Optional[int]=None,
thumb: Optional[Union[Any, str]]=None,
thumbnail: Optional[Union[Any, str]]=None,
caption_entities: Optional[List[types.MessageEntity]]=None,
allow_sending_without_reply: 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.
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.
: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.
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`
: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
: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
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(
apihelper.send_audio(
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))
# TODO: Rewrite this method like in API.
@ -2003,13 +2008,14 @@ class TeleBot:
parse_mode: Optional[str]=None,
disable_notification: Optional[bool]=None,
timeout: Optional[int]=None,
thumb: Optional[Union[Any, str]]=None,
thumbnail: Optional[Union[Any, str]]=None,
caption_entities: Optional[List[types.MessageEntity]]=None,
allow_sending_without_reply: Optional[bool]=None,
visible_file_name: Optional[str]=None,
disable_content_type_detection: Optional[bool]=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.
@ -2042,8 +2048,8 @@ class TeleBot:
:param timeout: Timeout in seconds for the request.
: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>
:type thumb: :obj:`str` or :class:`telebot.types.InputFile`
: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 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
:type caption_entities: :obj:`list` of :class:`telebot.types.MessageEntity`
@ -2078,11 +2084,15 @@ class TeleBot:
# function typo miss compatibility
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(
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 = thumb,
disable_notification = disable_notification, timeout = timeout, caption = caption, thumb = 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))
@ -2167,7 +2177,7 @@ class TeleBot:
duration: Optional[int]=None,
width: Optional[int]=None,
height: Optional[int]=None,
thumb: Optional[Union[Any, str]]=None,
thumbnail: Optional[Union[Any, str]]=None,
caption: Optional[str]=None,
parse_mode: Optional[str]=None,
caption_entities: Optional[List[types.MessageEntity]]=None,
@ -2180,7 +2190,8 @@ class TeleBot:
timeout: Optional[int]=None,
data: Optional[Union[Any, str]]=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).
@ -2201,8 +2212,8 @@ class TeleBot:
:param height: Video height
: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>.
:type thumb: :obj:`str` or :class:`telebot.types.InputFile`
: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 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
:type caption: :obj:`str`
@ -2257,10 +2268,14 @@ class TeleBot:
# function typo miss compatibility
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(
apihelper.send_video(
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))
def send_animation(
@ -2268,7 +2283,7 @@ class TeleBot:
duration: Optional[int]=None,
width: Optional[int]=None,
height: Optional[int]=None,
thumb: Optional[Union[Any, str]]=None,
thumbnail: Optional[Union[Any, str]]=None,
caption: Optional[str]=None,
parse_mode: Optional[str]=None,
caption_entities: Optional[List[types.MessageEntity]]=None,
@ -2279,7 +2294,8 @@ class TeleBot:
reply_markup: Optional[REPLY_MARKUP_TYPES]=None,
timeout: 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).
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
: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.
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: Animation caption (may also be used when resending animation by file_id), 0-1024 characters after entities parsing
:type caption: :obj:`str`
@ -2351,10 +2367,13 @@ class TeleBot:
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
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(
apihelper.send_animation(
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))
# TODO: Rewrite this method like in API.
@ -2366,10 +2385,11 @@ class TeleBot:
reply_markup: Optional[REPLY_MARKUP_TYPES]=None,
disable_notification: Optional[bool]=None,
timeout: Optional[int]=None,
thumb: Optional[Union[Any, str]]=None,
thumbnail: Optional[Union[Any, str]]=None,
allow_sending_without_reply: 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.
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.
: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.
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 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`
@ -2425,10 +2445,14 @@ class TeleBot:
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
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(
apihelper.send_video_note(
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(

View File

@ -697,11 +697,11 @@ def send_video(token, chat_id, data, duration=None, caption=None, reply_to_messa
if thumb:
if not util.is_string(thumb):
if files:
files['thumb'] = thumb
files['thumbnail'] = thumb
else:
files = {'thumb': thumb}
files = {'thumbnail': thumb}
else:
payload['thumb'] = thumb
payload['thumbnail'] = thumb
if width:
payload['width'] = width
if height:
@ -748,11 +748,11 @@ def send_animation(
if thumb:
if not util.is_string(thumb):
if files:
files['thumb'] = thumb
files['thumbnail'] = thumb
else:
files = {'thumb': thumb}
files = {'thumbnail': thumb}
else:
payload['thumb'] = thumb
payload['thumbnail'] = thumb
if caption_entities:
payload['caption_entities'] = json.dumps(types.MessageEntity.to_list_of_dicts(caption_entities))
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 not util.is_string(thumb):
if files:
files['thumb'] = thumb
files['thumbnail'] = thumb
else:
files = {'thumb': thumb}
files = {'thumbnail': thumb}
else:
payload['thumb'] = thumb
payload['thumbnail'] = thumb
if allow_sending_without_reply is not None:
payload['allow_sending_without_reply'] = allow_sending_without_reply
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 not util.is_string(thumb):
if files:
files['thumb'] = thumb
files['thumbnail'] = thumb
else:
files = {'thumb': thumb}
files = {'thumbnail': thumb}
else:
payload['thumb'] = thumb
payload['thumbnail'] = thumb
if caption_entities:
payload['caption_entities'] = json.dumps(types.MessageEntity.to_list_of_dicts(caption_entities))
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 not util.is_string(thumb):
if files:
files['thumb'] = thumb
files['thumbnail'] = thumb
else:
files = {'thumb': thumb}
files = {'thumbnail': thumb}
else:
payload['thumb'] = thumb
payload['thumbnail'] = thumb
if caption_entities:
payload['caption_entities'] = json.dumps(types.MessageEntity.to_list_of_dicts(caption_entities))
if allow_sending_without_reply is not None:

View File

@ -2700,11 +2700,12 @@ class AsyncTeleBot:
parse_mode: Optional[str]=None,
disable_notification: Optional[bool]=None,
timeout: Optional[int]=None,
thumb: Optional[Union[Any, str]]=None,
thumbnail: Optional[Union[Any, str]]=None,
caption_entities: Optional[List[types.MessageEntity]]=None,
allow_sending_without_reply: 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.
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.
: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.
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`
: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
: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
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(
await asyncio_helper.send_audio(
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))
async def send_voice(
@ -2864,14 +2869,15 @@ class AsyncTeleBot:
parse_mode: Optional[str]=None,
disable_notification: Optional[bool]=None,
timeout: Optional[int]=None,
thumb: Optional[Union[Any, str]]=None,
thumbnail: Optional[Union[Any, str]]=None,
caption_entities: Optional[List[types.MessageEntity]]=None,
allow_sending_without_reply: Optional[bool]=None,
visible_file_name: Optional[str]=None,
disable_content_type_detection: Optional[bool]=None,
data: Optional[Union[Any, str]]=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.
@ -2904,8 +2910,8 @@ class AsyncTeleBot:
:param timeout: Timeout in seconds for the request.
: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>
:type thumb: :obj:`str` or :class:`telebot.types.InputFile`
: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 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
:type caption_entities: :obj:`list` of :class:`telebot.types.MessageEntity`
@ -2940,11 +2946,15 @@ class AsyncTeleBot:
# function typo miss compatibility
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(
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 = thumb,
disable_notification = disable_notification, timeout = timeout, caption = caption, thumb = 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))
@ -3027,7 +3037,7 @@ class AsyncTeleBot:
duration: Optional[int]=None,
width: Optional[int]=None,
height: Optional[int]=None,
thumb: Optional[Union[Any, str]]=None,
thumbnail: Optional[Union[Any, str]]=None,
caption: Optional[str]=None,
parse_mode: Optional[str]=None,
caption_entities: Optional[List[types.MessageEntity]]=None,
@ -3040,7 +3050,8 @@ class AsyncTeleBot:
timeout: Optional[int]=None,
data: Optional[Union[Any, str]]=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).
@ -3061,8 +3072,8 @@ class AsyncTeleBot:
:param height: Video height
: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>.
:type thumb: :obj:`str` or :class:`telebot.types.InputFile`
: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 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
:type caption: :obj:`str`
@ -3118,10 +3129,14 @@ class AsyncTeleBot:
logger.warning("send_sticker: data parameter is deprecated. Use video instead.")
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(
await asyncio_helper.send_video(
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))
async def send_animation(
@ -3129,7 +3144,7 @@ class AsyncTeleBot:
duration: Optional[int]=None,
width: Optional[int]=None,
height: Optional[int]=None,
thumb: Optional[Union[Any, str]]=None,
thumbnail: Optional[Union[Any, str]]=None,
caption: Optional[str]=None,
parse_mode: Optional[str]=None,
caption_entities: Optional[List[types.MessageEntity]]=None,
@ -3140,7 +3155,8 @@ class AsyncTeleBot:
reply_markup: Optional[REPLY_MARKUP_TYPES]=None,
timeout: 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).
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
: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.
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: Animation caption (may also be used when resending animation by file_id), 0-1024 characters after entities parsing
:type caption: :obj:`str`
@ -3212,10 +3228,14 @@ class AsyncTeleBot:
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
if thumb is not None and thumbnail is None:
thumbnail = thumb
logger.warning('thumb is deprecated, use thumbnail instead')
return types.Message.de_json(
await asyncio_helper.send_animation(
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))
async def send_video_note(
@ -3226,10 +3246,11 @@ class AsyncTeleBot:
reply_markup: Optional[REPLY_MARKUP_TYPES]=None,
disable_notification: Optional[bool]=None,
timeout: Optional[int]=None,
thumb: Optional[Union[Any, str]]=None,
thumbnail: Optional[Union[Any, str]]=None,
allow_sending_without_reply: 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.
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.
: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.
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 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`
@ -3285,10 +3306,14 @@ class AsyncTeleBot:
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
if thumb is not None and thumbnail is None:
thumbnail = thumb
logger.warning('thumb is deprecated, use thumbnail instead')
return types.Message.de_json(
await asyncio_helper.send_video_note(
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(
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 not util.is_string(thumb):
if files:
files['thumb'] = thumb
files['thumbnail'] = thumb
else:
files = {'thumb': thumb}
files = {'thumbnail': thumb}
else:
payload['thumb'] = thumb
payload['thumbnail'] = thumb
if width:
payload['width'] = width
if height:
@ -740,11 +740,11 @@ async def send_animation(
if thumb:
if not util.is_string(thumb):
if files:
files['thumb'] = thumb
files['thumbnail'] = thumb
else:
files = {'thumb': thumb}
files = {'thumbnail': thumb}
else:
payload['thumb'] = thumb
payload['thumbnail'] = thumb
if caption_entities:
payload['caption_entities'] = json.dumps(types.MessageEntity.to_list_of_dicts(caption_entities))
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 not util.is_string(thumb):
if files:
files['thumb'] = thumb
files['thumbnail'] = thumb
else:
files = {'thumb': thumb}
files = {'thumbnail': thumb}
else:
payload['thumb'] = thumb
payload['thumbnail'] = thumb
if allow_sending_without_reply is not None:
payload['allow_sending_without_reply'] = allow_sending_without_reply
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 not util.is_string(thumb):
if files:
files['thumb'] = thumb
files['thumbnail'] = thumb
else:
files = {'thumb': thumb}
files = {'thumbnail': thumb}
else:
payload['thumb'] = thumb
payload['thumbnail'] = thumb
if caption_entities:
payload['caption_entities'] = json.dumps(types.MessageEntity.to_list_of_dicts(caption_entities))
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 not util.is_string(thumb):
if files:
files['thumb'] = thumb
files['thumbnail'] = thumb
else:
files = {'thumb': thumb}
files = {'thumbnail': thumb}
else:
payload['thumb'] = thumb
payload['thumbnail'] = thumb
if caption_entities:
payload['caption_entities'] = json.dumps(types.MessageEntity.to_list_of_dicts(caption_entities))
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.
:type file_size: :obj:`int`
:param thumb: Optional. Thumbnail of the album cover to which the music file belongs
:type thumb: :class:`telebot.types.PhotoSize`
:param thumbnail: Optional. Thumbnail of the album cover to which the music file belongs
:type thumbnail: :class:`telebot.types.PhotoSize`
:return: Instance of the class
:rtype: :class:`telebot.types.Audio`
@ -1562,14 +1562,14 @@ class Audio(JsonDeserializable):
def de_json(cls, json_string):
if json_string is None: return None
obj = cls.check_json(json_string)
if 'thumb' in obj and 'file_id' in obj['thumb']:
obj['thumb'] = PhotoSize.de_json(obj['thumb'])
if 'thumbnail' in obj and 'file_id' in obj['thumbnail']:
obj['thumbnail'] = PhotoSize.de_json(obj['thumbnail'])
else:
obj['thumb'] = None
obj['thumbnail'] = None
return cls(**obj)
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_unique_id: str = file_unique_id
self.duration: int = duration
@ -1578,7 +1578,8 @@ class Audio(JsonDeserializable):
self.file_name: str = file_name
self.mime_type: str = mime_type
self.file_size: int = file_size
self.thumb: PhotoSize = thumb
self.thumbnail: PhotoSize = thumbnail
self.thumb = thumbnail
class Voice(JsonDeserializable):
@ -1635,8 +1636,8 @@ class Document(JsonDeserializable):
bots. Can't be used to download or reuse the file.
:type file_unique_id: :obj:`str`
:param thumb: Optional. Document thumbnail as defined by sender
:type thumb: :class:`telebot.types.PhotoSize`
:param thumbnail: Optional. Document thumbnail as defined by sender
:type thumbnail: :class:`telebot.types.PhotoSize`
:param file_name: Optional. Original filename as defined by sender
:type file_name: :obj:`str`
@ -1656,19 +1657,20 @@ class Document(JsonDeserializable):
def de_json(cls, json_string):
if json_string is None: return None
obj = cls.check_json(json_string)
if 'thumb' in obj and 'file_id' in obj['thumb']:
obj['thumb'] = PhotoSize.de_json(obj['thumb'])
if 'thumbnail' in obj and 'file_id' in obj['thumbnail']:
obj['thumbnail'] = PhotoSize.de_json(obj['thumbnail'])
else:
obj['thumb'] = None
obj['thumbnail'] = None
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_unique_id: str = file_unique_id
self.thumb: PhotoSize = thumb
self.thumbnail: PhotoSize = thumbnail
self.file_name: str = file_name
self.mime_type: str = mime_type
self.file_size: int = file_size
self.thumb = thumbnail
class Video(JsonDeserializable):
@ -1693,8 +1695,8 @@ class Video(JsonDeserializable):
:param duration: Duration of the video in seconds as defined by sender
:type duration: :obj:`int`
:param thumb: Optional. Video thumbnail
:type thumb: :class:`telebot.types.PhotoSize`
:param thumbnail: Optional. Video thumbnail
:type thumbnail: :class:`telebot.types.PhotoSize`
:param file_name: Optional. Original filename as defined by sender
:type file_name: :obj:`str`
@ -1714,20 +1716,21 @@ class Video(JsonDeserializable):
def de_json(cls, json_string):
if json_string is None: return None
obj = cls.check_json(json_string)
if 'thumb' in obj and 'file_id' in obj['thumb']:
obj['thumb'] = PhotoSize.de_json(obj['thumb'])
if 'thumbnail' in obj and 'file_id' in obj['thumbnail']:
obj['thumbnail'] = PhotoSize.de_json(obj['thumbnail'])
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_unique_id: str = file_unique_id
self.width: int = width
self.height: int = height
self.duration: int = duration
self.thumb: PhotoSize = thumb
self.thumbnail: PhotoSize = thumbnail
self.file_name: str = file_name
self.mime_type: str = mime_type
self.file_size: int = file_size
self.thumb = thumbnail
class VideoNote(JsonDeserializable):
@ -1749,8 +1752,8 @@ class VideoNote(JsonDeserializable):
:param duration: Duration of the video in seconds as defined by sender
:type duration: :obj:`int`
:param thumb: Optional. Video thumbnail
:type thumb: :class:`telebot.types.PhotoSize`
:param thumbnail: Optional. Video thumbnail
:type thumbnail: :class:`telebot.types.PhotoSize`
:param file_size: Optional. File size in bytes
:type file_size: :obj:`int`
@ -1762,17 +1765,18 @@ class VideoNote(JsonDeserializable):
def de_json(cls, json_string):
if json_string is None: return None
obj = cls.check_json(json_string)
if 'thumb' in obj and 'file_id' in obj['thumb']:
obj['thumb'] = PhotoSize.de_json(obj['thumb'])
if 'thumbnail' in obj and 'file_id' in obj['thumbnail']:
obj['thumbnail'] = PhotoSize.de_json(obj['thumbnail'])
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_unique_id: str = file_unique_id
self.length: int = length
self.duration: int = duration
self.thumb: PhotoSize = thumb
self.thumbnail: PhotoSize = thumbnail
self.file_size: int = file_size
self.thumb = thumbnail
class Contact(JsonDeserializable):
@ -5389,8 +5393,8 @@ class Animation(JsonDeserializable):
:param duration: Duration of the video in seconds as defined by sender
:type duration: :obj:`int`
:param thumb: Optional. Animation thumbnail as defined by sender
:type thumb: :class:`telebot.types.PhotoSize`
:param thumbnail: Optional. Animation thumbnail as defined by sender
:type thumbnail: :class:`telebot.types.PhotoSize`
:param file_name: Optional. Original animation filename as defined by sender
:type file_name: :obj:`str`
@ -5410,20 +5414,21 @@ class Animation(JsonDeserializable):
def de_json(cls, json_string):
if (json_string is None): return None
obj = cls.check_json(json_string)
if 'thumb' in obj and 'file_id' in obj['thumb']:
obj["thumb"] = PhotoSize.de_json(obj['thumb'])
if 'thumbnail' in obj and 'file_id' in obj['thumbnail']:
obj["thumbnail"] = PhotoSize.de_json(obj['thumbnail'])
else:
obj['thumb'] = None
obj['thumbnail'] = None
return cls(**obj)
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_unique_id: str = file_unique_id
self.width: int = width
self.height: int = height
self.duration: int = duration
self.thumb: PhotoSize = thumb
self.thumbnail: PhotoSize = thumbnail
self.thumb: PhotoSize = thumbnail
self.file_name: str = file_name
self.mime_type: str = mime_type
self.file_size: int = file_size
@ -5819,8 +5824,8 @@ class StickerSet(JsonDeserializable):
:param stickers: List of all set stickers
:type stickers: :obj:`list` of :class:`telebot.types.Sticker`
:param thumb: Optional. Sticker set thumbnail in the .WEBP, .TGS, or .WEBM format
:type thumb: :class:`telebot.types.PhotoSize`
:param thumbnail: Optional. Sticker set thumbnail in the .WEBP, .TGS, or .WEBM format
:type thumbnail: :class:`telebot.types.PhotoSize`
:return: Instance of the class
:rtype: :class:`telebot.types.StickerSet`
@ -5833,20 +5838,21 @@ class StickerSet(JsonDeserializable):
for s in obj['stickers']:
stickers.append(Sticker.de_json(s))
obj['stickers'] = stickers
if 'thumb' in obj and 'file_id' in obj['thumb']:
obj['thumb'] = PhotoSize.de_json(obj['thumb'])
if 'thumbnail' in obj and 'file_id' in obj['thumbnail']:
obj['thumbnail'] = PhotoSize.de_json(obj['thumbnail'])
else:
obj['thumb'] = None
obj['thumbnail'] = None
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.title: str = title
self.sticker_type: str = sticker_type
self.is_animated: bool = is_animated
self.is_video: bool = is_video
self.stickers: List[Sticker] = stickers
self.thumb: PhotoSize = thumb
self.thumbnail: PhotoSize = thumbnail
self.thumb = thumbnail
@property
def contains_masks(self):
@ -5886,8 +5892,8 @@ class Sticker(JsonDeserializable):
:param is_video: True, if the sticker is a video sticker
:type is_video: :obj:`bool`
:param thumb: Optional. Sticker thumbnail in the .WEBP or .JPG format
:type thumb: :class:`telebot.types.PhotoSize`
:param thumbnail: Optional. Sticker thumbnail in the .WEBP or .JPG format
:type thumbnail: :class:`telebot.types.PhotoSize`
:param emoji: Optional. Emoji associated with the sticker
:type emoji: :obj:`str`
@ -5920,10 +5926,10 @@ class Sticker(JsonDeserializable):
def de_json(cls, json_string):
if (json_string is None): return None
obj = cls.check_json(json_string)
if 'thumb' in obj and 'file_id' in obj['thumb']:
obj['thumb'] = PhotoSize.de_json(obj['thumb'])
if 'thumbnail' in obj and 'file_id' in obj['thumbnail']:
obj['thumbnail'] = PhotoSize.de_json(obj['thumbnail'])
else:
obj['thumb'] = None
obj['thumbnail'] = None
if 'mask_position' in obj:
obj['mask_position'] = MaskPosition.de_json(obj['mask_position'])
if 'premium_animation' in obj:
@ -5931,7 +5937,7 @@ class Sticker(JsonDeserializable):
return cls(**obj)
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):
self.file_id: str = file_id
self.file_unique_id: str = file_unique_id
@ -5940,7 +5946,7 @@ class Sticker(JsonDeserializable):
self.height: int = height
self.is_animated: bool = is_animated
self.is_video: bool = is_video
self.thumb: PhotoSize = thumb
self.thumbnail: PhotoSize = thumbnail
self.emoji: str = emoji
self.set_name: str = set_name
self.mask_position: MaskPosition = mask_position
@ -5948,6 +5954,7 @@ class Sticker(JsonDeserializable):
self.premium_animation: File = premium_animation
self.custom_emoji_id: int = custom_emoji_id
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 »
: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
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>. 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
:type caption: :obj:`str`
@ -6135,21 +6142,22 @@ class InputMediaVideo(InputMedia):
:return: Instance of the class
: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):
super(InputMediaVideo, self).__init__(
type="video", media=media, caption=caption, parse_mode=parse_mode, caption_entities=caption_entities)
self.thumb = thumb
self.thumbnail = thumbnail
self.width = width
self.height = height
self.duration = duration
self.supports_streaming = supports_streaming
self.has_spoiler: Optional[bool] = has_spoiler
self.thumb = thumbnail
def to_dict(self):
ret = super(InputMediaVideo, self).to_dict()
if self.thumb:
ret['thumb'] = self.thumb
if self.thumbnail:
ret['thumbnail'] = self.thumbnail
if self.width:
ret['width'] = self.width
if self.height:
@ -6207,20 +6215,21 @@ class InputMediaAnimation(InputMedia):
:return: Instance of the class
: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):
super(InputMediaAnimation, self).__init__(
type="animation", media=media, caption=caption, parse_mode=parse_mode, caption_entities=caption_entities)
self.thumb = thumb
self.thumbnail = thumbnail
self.width = width
self.height = height
self.duration = duration
self.has_spoiler: Optional[bool] = has_spoiler
self.thumb = thumbnail
def to_dict(self):
ret = super(InputMediaAnimation, self).to_dict()
if self.thumb:
ret['thumb'] = self.thumb
if self.thumbnail:
ret['thumbnail'] = self.thumbnail
if self.width:
ret['width'] = self.width
if self.height:
@ -6243,12 +6252,12 @@ class InputMediaAudio(InputMedia):
multipart/form-data under <file_attach_name> name. More information on Sending Files »
: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
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>. 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
:type caption: :obj:`str`
@ -6273,19 +6282,20 @@ class InputMediaAudio(InputMedia):
:return: Instance of the class
: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):
super(InputMediaAudio, self).__init__(
type="audio", media=media, caption=caption, parse_mode=parse_mode, caption_entities=caption_entities)
self.thumb = thumb
self.thumbnail = thumbnail
self.duration = duration
self.performer = performer
self.title = title
self.thumb = thumbnail
def to_dict(self):
ret = super(InputMediaAudio, self).to_dict()
if self.thumb:
ret['thumb'] = self.thumb
if self.thumbnail:
ret['thumbnail'] = self.thumbnail
if self.duration:
ret['duration'] = self.duration
if self.performer:
@ -6306,12 +6316,12 @@ class InputMediaDocument(InputMedia):
multipart/form-data under <file_attach_name> name. More information on Sending Files »
: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
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>. 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
:type caption: :obj:`str`
@ -6331,17 +6341,18 @@ class InputMediaDocument(InputMedia):
:return: Instance of the class
: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):
super(InputMediaDocument, self).__init__(
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.thumb = thumbnail
def to_dict(self):
ret = super(InputMediaDocument, self).to_dict()
if self.thumb:
ret['thumb'] = self.thumb
if self.thumbnail:
ret['thumbnail'] = self.thumbnail
if self.disable_content_type_detection is not None:
ret['disable_content_type_detection'] = self.disable_content_type_detection
return ret