diff --git a/telebot/__init__.py b/telebot/__init__.py index 82c48c35b..7b834bbd9 100644 --- a/telebot/__init__.py +++ b/telebot/__init__.py @@ -2650,7 +2650,7 @@ def send_photo( def send_live_photo( self, chat_id: Union[int, str], live_photo: Union[Any, str], photo: Union[Any, str], - business_connection_id: Optional[str]=None, + message_thread_id: Optional[int]=None, business_connection_id: Optional[str]=None, caption: Optional[str]=None, parse_mode: Optional[str]=None, caption_entities: Optional[List[types.MessageEntity]]=None, show_caption_above_media: Optional[bool]=None, has_spoiler: Optional[bool]=None, disable_notification: Optional[bool]=None, protect_content: Optional[bool]=None, @@ -2662,6 +2662,9 @@ def send_live_photo( Telegram documentation: https://core.telegram.org/bots/api#sendlivephoto + :param message_thread_id: Identifier of a message thread, in which the message will be sent + :type message_thread_id: :obj:`int` + :param business_connection_id: Unique identifier of the business connection on behalf of which the message will be sent :type business_connection_id: :obj:`str` @@ -2726,10 +2729,13 @@ def send_live_photo( return types.Message.de_json( apihelper.send_live_photo( - self.token, chat_id, live_photo, photo, business_connection_id=business_connection_id, caption=caption, parse_mode=parse_mode, - caption_entities=caption_entities, show_caption_above_media=show_caption_above_media, has_spoiler=has_spoiler, disable_notification=disable_notification, - protect_content=protect_content, allow_paid_broadcast=allow_paid_broadcast, message_effect_id=message_effect_id, - suggested_post_parameters=suggested_post_parameters, reply_parameters=reply_parameters, reply_markup=reply_markup + self.token, chat_id, live_photo, photo, message_thread_id=message_thread_id, + business_connection_id=business_connection_id, caption=caption, parse_mode=parse_mode, + caption_entities=caption_entities, show_caption_above_media=show_caption_above_media, + has_spoiler=has_spoiler, disable_notification=disable_notification, protect_content=protect_content, + allow_paid_broadcast=allow_paid_broadcast, message_effect_id=message_effect_id, + suggested_post_parameters=suggested_post_parameters, reply_parameters=reply_parameters, + reply_markup=reply_markup ) ) diff --git a/telebot/apihelper.py b/telebot/apihelper.py index e9aa88e92..a2f02c9c9 100644 --- a/telebot/apihelper.py +++ b/telebot/apihelper.py @@ -625,9 +625,9 @@ def send_photo( def send_live_photo( token, chat_id, live_photo, photo, - caption=None, parse_mode=None, caption_entities=None, show_caption_above_media=None, has_spoiler=None, - disable_notification=None, protect_content=None, reply_parameters=None, reply_markup=None, - business_connection_id=None, message_effect_id=None, allow_paid_broadcast=None, + message_thread_id=None, business_connection_id=None, caption=None, parse_mode=None, caption_entities=None, + show_caption_above_media=None, has_spoiler=None, disable_notification=None, protect_content=None, + reply_parameters=None, reply_markup=None, message_effect_id=None, allow_paid_broadcast=None, direct_messages_topic_id=None, suggested_post_parameters=None): method_url = r'sendLivePhoto' files = {} @@ -642,6 +642,8 @@ def send_live_photo( files['photo'] = util.pil_image_to_file(photo) else: files['photo'] = photo + if message_thread_id is not None: + payload['message_thread_id'] = message_thread_id if caption: payload['caption'] = caption if parse_mode: diff --git a/telebot/async_telebot.py b/telebot/async_telebot.py index 8a326e8a6..dbf716460 100644 --- a/telebot/async_telebot.py +++ b/telebot/async_telebot.py @@ -4288,7 +4288,7 @@ async def send_photo( async def send_live_photo( self, chat_id: Union[int, str], live_photo: Union[Any, str], photo: Union[Any, str], - business_connection_id: Optional[str]=None, + message_thread_id: Optional[int] = None, business_connection_id: Optional[str]=None, caption: Optional[str]=None, parse_mode: Optional[str]=None, caption_entities: Optional[List[types.MessageEntity]]=None, show_caption_above_media: Optional[bool]=None, has_spoiler: Optional[bool]=None, @@ -4301,6 +4301,9 @@ async def send_live_photo( Telegram documentation: https://core.telegram.org/bots/api#sendlivephoto + :param message_thread_id: Identifier of a message thread, in which the message will be sent + :type message_thread_id: :obj:`int` + :param business_connection_id: Unique identifier of the business connection on behalf of which the message will be sent :type business_connection_id: :obj:`str` @@ -4367,9 +4370,13 @@ async def send_live_photo( return types.Message.de_json( await asyncio_helper.send_live_photo( - self.token, chat_id, live_photo, photo, business_connection_id=business_connection_id, caption=caption, parse_mode=parse_mode, caption_entities=caption_entities, - show_caption_above_media=show_caption_above_media, has_spoiler=has_spoiler, disable_notification=disable_notification, protect_content=protect_content, - allow_paid_broadcast=allow_paid_broadcast, message_effect_id=message_effect_id, suggested_post_parameters=suggested_post_parameters, reply_parameters=reply_parameters, reply_markup=reply_markup + self.token, chat_id, live_photo, photo, message_thread_id=message_thread_id, + business_connection_id=business_connection_id, caption=caption, parse_mode=parse_mode, + caption_entities=caption_entities, show_caption_above_media=show_caption_above_media, + has_spoiler=has_spoiler, disable_notification=disable_notification, protect_content=protect_content, + allow_paid_broadcast=allow_paid_broadcast, message_effect_id=message_effect_id, + suggested_post_parameters=suggested_post_parameters, reply_parameters=reply_parameters, + reply_markup=reply_markup ) ) diff --git a/telebot/types.py b/telebot/types.py index 0fde49346..6396b9fec 100644 --- a/telebot/types.py +++ b/telebot/types.py @@ -1623,7 +1623,6 @@ def de_json(cls, json_string): if 'gift_upgrade_sent' in obj: opts['gift_upgrade_sent'] = GiftInfo.de_json(obj['gift_upgrade_sent']) content_type = 'gift_upgrade_sent' - if 'reply_to_checklist_task_id' in obj: opts['reply_to_checklist_task_id'] = obj['reply_to_checklist_task_id'] if 'direct_messages_topic' in obj: @@ -1663,6 +1662,9 @@ def de_json(cls, json_string): if 'poll_option_deleted' in obj: opts['poll_option_deleted'] = PollOptionDeleted.de_json(obj['poll_option_deleted']) content_type = 'poll_option_deleted' + if 'live_photo' in obj: + opts['live_photo'] = LivePhoto.de_json(obj['live_photo']) + content_type = 'live_photo' if 'reply_to_poll_option_id' in obj: opts['reply_to_poll_option_id'] = obj['reply_to_poll_option_id'] if 'guest_bot_caller_user' in obj: @@ -1671,8 +1673,6 @@ def de_json(cls, json_string): opts['guest_bot_caller_chat'] = Chat.de_json(obj['guest_bot_caller_chat']) if 'guest_query_id' in obj: opts['guest_query_id'] = obj['guest_query_id'] - if 'live_photo' in obj: - opts['live_photo'] = LivePhoto.de_json(obj['live_photo']) return cls(message_id, from_user, date, chat, content_type, opts, json_string) @classmethod @@ -14543,4 +14543,3 @@ def de_json(cls, json_string): if 'added_users' in obj: obj['added_users'] = [User.de_json(user) for user in obj['added_users']] return cls(**obj) - \ No newline at end of file