From cd4dc899a197c475bdc481069547b63080d49186 Mon Sep 17 00:00:00 2001 From: Badiboy Date: Fri, 2 Dec 2022 23:46:26 +0300 Subject: [PATCH] Fix caption_entities miss in InputMediaXXX --- telebot/types.py | 47 ++++++++++++++++++++--------------------------- 1 file changed, 20 insertions(+), 27 deletions(-) diff --git a/telebot/types.py b/telebot/types.py index f6a03c4..5e843d2 100644 --- a/telebot/types.py +++ b/telebot/types.py @@ -5765,9 +5765,6 @@ class InputMediaPhoto(InputMedia): Telegram Documentation: https://core.telegram.org/bots/api#inputmediaphoto - :param type: Type of the result, must be photo - :type type: :obj:`str` - :param media: File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass “attach://” to upload a new one using multipart/form-data under name. More information on Sending Files » @@ -5787,11 +5784,12 @@ class InputMediaPhoto(InputMedia): :return: Instance of the class :rtype: :class:`telebot.types.InputMediaPhoto` """ - def __init__(self, media, caption=None, parse_mode=None): + def __init__(self, media, caption=None, parse_mode=None, caption_entities=None): if util.is_pil_image(media): media = util.pil_image_to_file(media) - super(InputMediaPhoto, self).__init__(type="photo", media=media, caption=caption, parse_mode=parse_mode) + super(InputMediaPhoto, self).__init__( + type="photo", media=media, caption=caption, parse_mode=parse_mode, caption_entities=caption_entities) def to_dict(self): return super(InputMediaPhoto, self).to_dict() @@ -5803,9 +5801,6 @@ class InputMediaVideo(InputMedia): Telegram Documentation: https://core.telegram.org/bots/api#inputmediavideo - :param type: Type of the result, must be video - :type type: :obj:`str` - :param media: File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass “attach://” to upload a new one using multipart/form-data under name. More information on Sending Files » @@ -5844,9 +5839,10 @@ class InputMediaVideo(InputMedia): :return: Instance of the class :rtype: :class:`telebot.types.InputMediaVideo` """ - def __init__(self, media, thumb=None, caption=None, parse_mode=None, width=None, height=None, duration=None, - supports_streaming=None): - super(InputMediaVideo, self).__init__(type="video", media=media, caption=caption, parse_mode=parse_mode) + def __init__(self, media, thumb=None, caption=None, parse_mode=None, caption_entities=None, + width=None, height=None, duration=None, supports_streaming=None): + super(InputMediaVideo, self).__init__( + type="video", media=media, caption=caption, parse_mode=parse_mode, caption_entities=caption_entities) self.thumb = thumb self.width = width self.height = height @@ -5874,9 +5870,6 @@ class InputMediaAnimation(InputMedia): Telegram Documentation: https://core.telegram.org/bots/api#inputmediaanimation - :param type: Type of the result, must be animation - :type type: :obj:`str` - :param media: File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass “attach://” to upload a new one using multipart/form-data under name. More information on Sending Files » @@ -5912,8 +5905,10 @@ class InputMediaAnimation(InputMedia): :return: Instance of the class :rtype: :class:`telebot.types.InputMediaAnimation` """ - def __init__(self, media, thumb=None, caption=None, parse_mode=None, width=None, height=None, duration=None): - super(InputMediaAnimation, self).__init__(type="animation", media=media, caption=caption, parse_mode=parse_mode) + def __init__(self, media, thumb=None, caption=None, parse_mode=None, caption_entities=None, + width=None, height=None, duration=None): + super(InputMediaAnimation, self).__init__( + type="animation", media=media, caption=caption, parse_mode=parse_mode, caption_entities=caption_entities) self.thumb = thumb self.width = width self.height = height @@ -5938,9 +5933,6 @@ class InputMediaAudio(InputMedia): Telegram Documentation: https://core.telegram.org/bots/api#inputmediaaudio - :param type: Type of the result, must be audio - :type type: :obj:`str` - :param media: File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass “attach://” to upload a new one using multipart/form-data under name. More information on Sending Files » @@ -5976,8 +5968,10 @@ class InputMediaAudio(InputMedia): :return: Instance of the class :rtype: :class:`telebot.types.InputMediaAudio` """ - def __init__(self, media, thumb=None, caption=None, parse_mode=None, duration=None, performer=None, title=None): - super(InputMediaAudio, self).__init__(type="audio", media=media, caption=caption, parse_mode=parse_mode) + def __init__(self, media, thumb=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.duration = duration self.performer = performer @@ -6002,10 +5996,7 @@ class InputMediaDocument(InputMedia): Telegram Documentation: https://core.telegram.org/bots/api#inputmediadocument - :param type: Type of the result, must be document - :type type: :obj:`str` - - :param media: File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an + :param media: File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass “attach://” to upload a new one using multipart/form-data under name. More information on Sending Files » :type media: :obj:`str` @@ -6035,8 +6026,10 @@ class InputMediaDocument(InputMedia): :return: Instance of the class :rtype: :class:`telebot.types.InputMediaDocument` """ - def __init__(self, media, thumb=None, caption=None, parse_mode=None, disable_content_type_detection=None): - super(InputMediaDocument, self).__init__(type="document", media=media, caption=caption, parse_mode=parse_mode) + def __init__(self, media, thumb=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.disable_content_type_detection = disable_content_type_detection