From 30c9088023c6cbe9071149973f1a01cbc18a9eb1 Mon Sep 17 00:00:00 2001 From: wulan17 Date: Sat, 22 Jul 2023 01:58:11 +0700 Subject: [PATCH] Pyrofork: Update some methods to layer 160 Signed-off-by: wulan17 --- pyrogram/methods/bots/send_game.py | 16 +++++++++++++- .../methods/bots/send_inline_bot_result.py | 21 ++++++++++++++++++- pyrogram/methods/messages/copy_media_group.py | 21 ++++++++++++++++++- pyrogram/methods/messages/copy_message.py | 16 +++++++++++++- pyrogram/methods/messages/send_animation.py | 16 +++++++++++++- pyrogram/methods/messages/send_audio.py | 16 +++++++++++++- .../methods/messages/send_cached_media.py | 16 +++++++++++++- pyrogram/methods/messages/send_contact.py | 17 ++++++++++++++- pyrogram/methods/messages/send_dice.py | 16 +++++++++++++- pyrogram/methods/messages/send_document.py | 16 +++++++++++++- pyrogram/methods/messages/send_location.py | 17 ++++++++++++++- pyrogram/methods/messages/send_media_group.py | 16 +++++++++++++- pyrogram/methods/messages/send_message.py | 16 +++++++++++++- pyrogram/methods/messages/send_photo.py | 16 +++++++++++++- pyrogram/methods/messages/send_poll.py | 16 +++++++++++++- pyrogram/methods/messages/send_sticker.py | 16 +++++++++++++- pyrogram/methods/messages/send_venue.py | 17 ++++++++++++++- pyrogram/methods/messages/send_video.py | 16 +++++++++++++- pyrogram/methods/messages/send_video_note.py | 16 +++++++++++++- pyrogram/methods/messages/send_voice.py | 16 +++++++++++++- 20 files changed, 313 insertions(+), 20 deletions(-) diff --git a/pyrogram/methods/bots/send_game.py b/pyrogram/methods/bots/send_game.py index 1194a3ef2..a35c6df0a 100644 --- a/pyrogram/methods/bots/send_game.py +++ b/pyrogram/methods/bots/send_game.py @@ -78,6 +78,20 @@ async def send_game( await app.send_game(chat_id, "gamename") """ + reply_to = None + if reply_to_message_id or message_thread_id: + reply_to_msg_id = None + top_msg_id = None + if message_thread_id: + if not reply_to_message_id: + reply_to_msg_id = message_thread_id + else: + reply_to_msg_id = reply_to_message_id + top_msg_id = message_thread_id + else: + reply_to_msg_id = reply_to_message_id + reply_to = raw.types.InputReplyToMessage(reply_to_msg_id=reply_to_msg_id, top_msg_id=top_msg_id) + r = await self.invoke( raw.functions.messages.SendMedia( peer=await self.resolve_peer(chat_id), @@ -89,7 +103,7 @@ async def send_game( ), message="", silent=disable_notification or None, - reply_to_msg_id=reply_to_message_id or message_thread_id, + reply_to=reply_to, random_id=self.rnd_id(), noforwards=protect_content, reply_markup=await reply_markup.write(self) if reply_markup else None diff --git a/pyrogram/methods/bots/send_inline_bot_result.py b/pyrogram/methods/bots/send_inline_bot_result.py index 0df09388e..5bc704829 100644 --- a/pyrogram/methods/bots/send_inline_bot_result.py +++ b/pyrogram/methods/bots/send_inline_bot_result.py @@ -53,6 +53,10 @@ async def send_inline_bot_result( Sends the message silently. Users will receive a notification with no sound. + message_thread_id (``int``, *optional*): + Unique identifier of a message thread to which the message belongs. + for supergroups only + reply_to_message_id (``bool``, *optional*): If the message is a reply, ID of the original message. @@ -64,6 +68,21 @@ async def send_inline_bot_result( await app.send_inline_bot_result(chat_id, query_id, result_id) """ + + reply_to = None + if reply_to_message_id or message_thread_id: + reply_to_msg_id = None + top_msg_id = None + if message_thread_id: + if not reply_to_message_id: + reply_to_msg_id = message_thread_id + else: + reply_to_msg_id = reply_to_message_id + top_msg_id = message_thread_id + else: + reply_to_msg_id = reply_to_message_id + reply_to = raw.types.InputReplyToMessage(reply_to_msg_id=reply_to_msg_id, top_msg_id=top_msg_id) + return await self.invoke( raw.functions.messages.SendInlineBotResult( peer=await self.resolve_peer(chat_id), @@ -71,6 +90,6 @@ async def send_inline_bot_result( id=result_id, random_id=self.rnd_id(), silent=disable_notification or None, - reply_to_msg_id=reply_to_message_id or message_thread_id + reply_to=reply_to ) ) diff --git a/pyrogram/methods/messages/copy_media_group.py b/pyrogram/methods/messages/copy_media_group.py index 52911ea0b..f01a14f8d 100644 --- a/pyrogram/methods/messages/copy_media_group.py +++ b/pyrogram/methods/messages/copy_media_group.py @@ -31,6 +31,7 @@ async def copy_media_group( message_id: int, captions: Union[List[str], str] = None, disable_notification: bool = None, + message_thread_id: int = None, reply_to_message_id: int = None, schedule_date: datetime = None, ) -> List["types.Message"]: @@ -65,6 +66,10 @@ async def copy_media_group( Sends the message silently. Users will receive a notification with no sound. + message_thread_id (``int``, *optional*): + Unique identifier for the target message thread (topic) of the forum. + for forum supergroups only. + reply_to_message_id (``int``, *optional*): If the message is a reply, ID of the original message. @@ -89,6 +94,20 @@ async def copy_media_group( media_group = await self.get_media_group(from_chat_id, message_id) multi_media = [] + reply_to = None + if reply_to_message_id or message_thread_id: + reply_to_msg_id = None + top_msg_id = None + if message_thread_id: + if not reply_to_message_id: + reply_to_msg_id = message_thread_id + else: + reply_to_msg_id = reply_to_message_id + top_msg_id = message_thread_id + else: + reply_to_msg_id = reply_to_message_id + reply_to = raw.types.InputReplyToMessage(reply_to_msg_id=reply_to_msg_id, top_msg_id=top_msg_id) + for i, message in enumerate(media_group): if message.photo: file_id = message.photo.file_id @@ -119,7 +138,7 @@ async def copy_media_group( peer=await self.resolve_peer(chat_id), multi_media=multi_media, silent=disable_notification or None, - reply_to_msg_id=reply_to_message_id, + reply_to=reply_to, schedule_date=utils.datetime_to_timestamp(schedule_date) ), sleep_threshold=60 diff --git a/pyrogram/methods/messages/copy_message.py b/pyrogram/methods/messages/copy_message.py index 5699ac55e..9e455be55 100644 --- a/pyrogram/methods/messages/copy_message.py +++ b/pyrogram/methods/messages/copy_message.py @@ -113,13 +113,27 @@ async def copy_message( """ message: types.Message = await self.get_messages(from_chat_id, message_id) + reply_to = None + if reply_to_message_id or message_thread_id: + reply_to_msg_id = None + top_msg_id = None + if message_thread_id: + if not reply_to_message_id: + reply_to_msg_id = message_thread_id + else: + reply_to_msg_id = reply_to_message_id + top_msg_id = message_thread_id + else: + reply_to_msg_id = reply_to_message_id + reply_to = raw.types.InputReplyToMessage(reply_to_msg_id=reply_to_msg_id, top_msg_id=top_msg_id) + return await message.copy( chat_id=chat_id, caption=caption, parse_mode=parse_mode, caption_entities=caption_entities, disable_notification=disable_notification, - reply_to_message_id=reply_to_message_id or message_thread_id, + reply_to=reply_to, schedule_date=schedule_date, protect_content=protect_content, reply_markup=reply_markup diff --git a/pyrogram/methods/messages/send_animation.py b/pyrogram/methods/messages/send_animation.py index 61b62cfa3..189fbaac8 100644 --- a/pyrogram/methods/messages/send_animation.py +++ b/pyrogram/methods/messages/send_animation.py @@ -180,6 +180,20 @@ async def progress(current, total): """ file = None + reply_to = None + if reply_to_message_id or message_thread_id: + reply_to_msg_id = None + top_msg_id = None + if message_thread_id: + if not reply_to_message_id: + reply_to_msg_id = message_thread_id + else: + reply_to_msg_id = reply_to_message_id + top_msg_id = message_thread_id + else: + reply_to_msg_id = reply_to_message_id + reply_to = raw.types.InputReplyToMessage(reply_to_msg_id=reply_to_msg_id, top_msg_id=top_msg_id) + try: if isinstance(animation, str): if os.path.isfile(animation): @@ -235,7 +249,7 @@ async def progress(current, total): peer=await self.resolve_peer(chat_id), media=media, silent=disable_notification or None, - reply_to_msg_id=reply_to_message_id or message_thread_id, + reply_to=reply_to, random_id=self.rnd_id(), schedule_date=utils.datetime_to_timestamp(schedule_date), noforwards=protect_content, diff --git a/pyrogram/methods/messages/send_audio.py b/pyrogram/methods/messages/send_audio.py index 1cdc6d5a6..212f43310 100644 --- a/pyrogram/methods/messages/send_audio.py +++ b/pyrogram/methods/messages/send_audio.py @@ -174,6 +174,20 @@ async def progress(current, total): """ file = None + reply_to = None + if reply_to_message_id or message_thread_id: + reply_to_msg_id = None + top_msg_id = None + if message_thread_id: + if not reply_to_message_id: + reply_to_msg_id = message_thread_id + else: + reply_to_msg_id = reply_to_message_id + top_msg_id = message_thread_id + else: + reply_to_msg_id = reply_to_message_id + reply_to = raw.types.InputReplyToMessage(reply_to_msg_id=reply_to_msg_id, top_msg_id=top_msg_id) + try: if isinstance(audio, str): if os.path.isfile(audio): @@ -222,7 +236,7 @@ async def progress(current, total): peer=await self.resolve_peer(chat_id), media=media, silent=disable_notification or None, - reply_to_msg_id=reply_to_message_id or message_thread_id, + reply_to=reply_to, random_id=self.rnd_id(), schedule_date=utils.datetime_to_timestamp(schedule_date), noforwards=protect_content, diff --git a/pyrogram/methods/messages/send_cached_media.py b/pyrogram/methods/messages/send_cached_media.py index beaf19dbf..5213a874a 100644 --- a/pyrogram/methods/messages/send_cached_media.py +++ b/pyrogram/methods/messages/send_cached_media.py @@ -103,12 +103,26 @@ async def send_cached_media( await app.send_cached_media("me", file_id) """ + reply_to = None + if reply_to_message_id or message_thread_id: + reply_to_msg_id = None + top_msg_id = None + if message_thread_id: + if not reply_to_message_id: + reply_to_msg_id = message_thread_id + else: + reply_to_msg_id = reply_to_message_id + top_msg_id = message_thread_id + else: + reply_to_msg_id = reply_to_message_id + reply_to = raw.types.InputReplyToMessage(reply_to_msg_id=reply_to_msg_id, top_msg_id=top_msg_id) + r = await self.invoke( raw.functions.messages.SendMedia( peer=await self.resolve_peer(chat_id), media=utils.get_input_media_from_file_id(file_id), silent=disable_notification or None, - reply_to_msg_id=reply_to_message_id or message_thread_id, + reply_to=reply_to, random_id=self.rnd_id(), schedule_date=utils.datetime_to_timestamp(schedule_date), noforwards=protect_content, diff --git a/pyrogram/methods/messages/send_contact.py b/pyrogram/methods/messages/send_contact.py index 32b468359..9be6ca521 100644 --- a/pyrogram/methods/messages/send_contact.py +++ b/pyrogram/methods/messages/send_contact.py @@ -95,6 +95,21 @@ async def send_contact( await app.send_contact("me", "+1-123-456-7890", "Name") """ + + reply_to = None + if reply_to_message_id or message_thread_id: + reply_to_msg_id = None + top_msg_id = None + if message_thread_id: + if not reply_to_message_id: + reply_to_msg_id = message_thread_id + else: + reply_to_msg_id = reply_to_message_id + top_msg_id = message_thread_id + else: + reply_to_msg_id = reply_to_message_id + reply_to = raw.types.InputReplyToMessage(reply_to_msg_id=reply_to_msg_id, top_msg_id=top_msg_id) + r = await self.invoke( raw.functions.messages.SendMedia( peer=await self.resolve_peer(chat_id), @@ -106,7 +121,7 @@ async def send_contact( ), message="", silent=disable_notification or None, - reply_to_msg_id=reply_to_message_id or message_thread_id, + reply_to=reply_to, random_id=self.rnd_id(), schedule_date=utils.datetime_to_timestamp(schedule_date), noforwards=protect_content, diff --git a/pyrogram/methods/messages/send_dice.py b/pyrogram/methods/messages/send_dice.py index f9f7a4d5d..92c3d2c8a 100644 --- a/pyrogram/methods/messages/send_dice.py +++ b/pyrogram/methods/messages/send_dice.py @@ -95,12 +95,26 @@ async def send_dice( await app.send_dice(chat_id, "🏀") """ + reply_to = None + if reply_to_message_id or message_thread_id: + reply_to_msg_id = None + top_msg_id = None + if message_thread_id: + if not reply_to_message_id: + reply_to_msg_id = message_thread_id + else: + reply_to_msg_id = reply_to_message_id + top_msg_id = message_thread_id + else: + reply_to_msg_id = reply_to_message_id + reply_to = raw.types.InputReplyToMessage(reply_to_msg_id=reply_to_msg_id, top_msg_id=top_msg_id) + r = await self.invoke( raw.functions.messages.SendMedia( peer=await self.resolve_peer(chat_id), media=raw.types.InputMediaDice(emoticon=emoji), silent=disable_notification or None, - reply_to_msg_id=reply_to_message_id or message_thread_id, + reply_to=reply_to, random_id=self.rnd_id(), schedule_date=utils.datetime_to_timestamp(schedule_date), noforwards=protect_content, diff --git a/pyrogram/methods/messages/send_document.py b/pyrogram/methods/messages/send_document.py index e0f4288ee..adfd9eb80 100644 --- a/pyrogram/methods/messages/send_document.py +++ b/pyrogram/methods/messages/send_document.py @@ -161,6 +161,20 @@ async def progress(current, total): """ file = None + reply_to = None + if reply_to_message_id or message_thread_id: + reply_to_msg_id = None + top_msg_id = None + if message_thread_id: + if not reply_to_message_id: + reply_to_msg_id = message_thread_id + else: + reply_to_msg_id = reply_to_message_id + top_msg_id = message_thread_id + else: + reply_to_msg_id = reply_to_message_id + reply_to = raw.types.InputReplyToMessage(reply_to_msg_id=reply_to_msg_id, top_msg_id=top_msg_id) + try: if isinstance(document, str): if os.path.isfile(document): @@ -200,7 +214,7 @@ async def progress(current, total): peer=await self.resolve_peer(chat_id), media=media, silent=disable_notification or None, - reply_to_msg_id=reply_to_message_id or message_thread_id, + reply_to=reply_to, random_id=self.rnd_id(), schedule_date=utils.datetime_to_timestamp(schedule_date), noforwards=protect_content, diff --git a/pyrogram/methods/messages/send_location.py b/pyrogram/methods/messages/send_location.py index dd6079ec9..3ae8c88fd 100644 --- a/pyrogram/methods/messages/send_location.py +++ b/pyrogram/methods/messages/send_location.py @@ -87,6 +87,21 @@ async def send_location( app.send_location("me", latitude, longitude) """ + + reply_to = None + if reply_to_message_id or message_thread_id: + reply_to_msg_id = None + top_msg_id = None + if message_thread_id: + if not reply_to_message_id: + reply_to_msg_id = message_thread_id + else: + reply_to_msg_id = reply_to_message_id + top_msg_id = message_thread_id + else: + reply_to_msg_id = reply_to_message_id + reply_to = raw.types.InputReplyToMessage(reply_to_msg_id=reply_to_msg_id, top_msg_id=top_msg_id) + r = await self.invoke( raw.functions.messages.SendMedia( peer=await self.resolve_peer(chat_id), @@ -98,7 +113,7 @@ async def send_location( ), message="", silent=disable_notification or None, - reply_to_msg_id=reply_to_message_id or message_thread_id, + reply_to=reply_to, random_id=self.rnd_id(), schedule_date=utils.datetime_to_timestamp(schedule_date), noforwards=protect_content, diff --git a/pyrogram/methods/messages/send_media_group.py b/pyrogram/methods/messages/send_media_group.py index 16bfbfaab..6a06cc367 100644 --- a/pyrogram/methods/messages/send_media_group.py +++ b/pyrogram/methods/messages/send_media_group.py @@ -99,6 +99,20 @@ async def send_media_group( """ multi_media = [] + reply_to = None + if reply_to_message_id or message_thread_id: + reply_to_msg_id = None + top_msg_id = None + if message_thread_id: + if not reply_to_message_id: + reply_to_msg_id = message_thread_id + else: + reply_to_msg_id = reply_to_message_id + top_msg_id = message_thread_id + else: + reply_to_msg_id = reply_to_message_id + reply_to = raw.types.InputReplyToMessage(reply_to_msg_id=reply_to_msg_id, top_msg_id=top_msg_id) + for i in media: if isinstance(i, types.InputMediaPhoto): if isinstance(i.media, str): @@ -412,7 +426,7 @@ async def send_media_group( peer=await self.resolve_peer(chat_id), multi_media=multi_media, silent=disable_notification or None, - reply_to_msg_id=reply_to_message_id or message_thread_id, + reply_to=reply_to, schedule_date=utils.datetime_to_timestamp(schedule_date), noforwards=protect_content ), diff --git a/pyrogram/methods/messages/send_message.py b/pyrogram/methods/messages/send_message.py index ffc32dd11..14a4d4292 100644 --- a/pyrogram/methods/messages/send_message.py +++ b/pyrogram/methods/messages/send_message.py @@ -128,12 +128,26 @@ async def send_message( message, entities = (await utils.parse_text_entities(self, text, parse_mode, entities)).values() + reply_to = None + if reply_to_message_id or message_thread_id: + reply_to_msg_id = None + top_msg_id = None + if message_thread_id: + if not reply_to_message_id: + reply_to_msg_id = message_thread_id + else: + reply_to_msg_id = reply_to_message_id + top_msg_id = message_thread_id + else: + reply_to_msg_id = reply_to_message_id + reply_to = raw.types.InputReplyToMessage(reply_to_msg_id=reply_to_msg_id, top_msg_id=top_msg_id) + r = await self.invoke( raw.functions.messages.SendMessage( peer=await self.resolve_peer(chat_id), no_webpage=disable_web_page_preview or None, silent=disable_notification or None, - reply_to_msg_id=reply_to_message_id or message_thread_id, + reply_to=reply_to, random_id=self.rnd_id(), schedule_date=utils.datetime_to_timestamp(schedule_date), reply_markup=await reply_markup.write(self) if reply_markup else None, diff --git a/pyrogram/methods/messages/send_photo.py b/pyrogram/methods/messages/send_photo.py index d597bf7c4..3555a8d6e 100644 --- a/pyrogram/methods/messages/send_photo.py +++ b/pyrogram/methods/messages/send_photo.py @@ -152,6 +152,20 @@ async def send_photo( """ file = None + reply_to = None + if reply_to_message_id or message_thread_id: + reply_to_msg_id = None + top_msg_id = None + if message_thread_id: + if not reply_to_message_id: + reply_to_msg_id = message_thread_id + else: + reply_to_msg_id = reply_to_message_id + top_msg_id = message_thread_id + else: + reply_to_msg_id = reply_to_message_id + reply_to = raw.types.InputReplyToMessage(reply_to_msg_id=reply_to_msg_id, top_msg_id=top_msg_id) + try: if isinstance(photo, str): if os.path.isfile(photo): @@ -184,7 +198,7 @@ async def send_photo( peer=await self.resolve_peer(chat_id), media=media, silent=disable_notification or None, - reply_to_msg_id=reply_to_message_id or message_thread_id, + reply_to=reply_to, random_id=self.rnd_id(), schedule_date=utils.datetime_to_timestamp(schedule_date), noforwards=protect_content, diff --git a/pyrogram/methods/messages/send_poll.py b/pyrogram/methods/messages/send_poll.py index 106177d7f..f384584a8 100644 --- a/pyrogram/methods/messages/send_poll.py +++ b/pyrogram/methods/messages/send_poll.py @@ -138,6 +138,20 @@ async def send_poll( await app.send_poll(chat_id, "Is this a poll question?", ["Yes", "No", "Maybe"]) """ + reply_to = None + if reply_to_message_id or message_thread_id: + reply_to_msg_id = None + top_msg_id = None + if message_thread_id: + if not reply_to_message_id: + reply_to_msg_id = message_thread_id + else: + reply_to_msg_id = reply_to_message_id + top_msg_id = message_thread_id + else: + reply_to_msg_id = reply_to_message_id + reply_to = raw.types.InputReplyToMessage(reply_to_msg_id=reply_to_msg_id, top_msg_id=top_msg_id) + solution, solution_entities = (await utils.parse_text_entities( self, explanation, explanation_parse_mode, explanation_entities )).values() @@ -166,7 +180,7 @@ async def send_poll( ), message="", silent=disable_notification, - reply_to_msg_id=reply_to_message_id or message_thread_id, + reply_to=reply_to, random_id=self.rnd_id(), schedule_date=utils.datetime_to_timestamp(schedule_date), noforwards=protect_content, diff --git a/pyrogram/methods/messages/send_sticker.py b/pyrogram/methods/messages/send_sticker.py index 6b6d0090f..44628e65b 100644 --- a/pyrogram/methods/messages/send_sticker.py +++ b/pyrogram/methods/messages/send_sticker.py @@ -125,6 +125,20 @@ async def send_sticker( """ file = None + reply_to = None + if reply_to_message_id or message_thread_id: + reply_to_msg_id = None + top_msg_id = None + if message_thread_id: + if not reply_to_message_id: + reply_to_msg_id = message_thread_id + else: + reply_to_msg_id = reply_to_message_id + top_msg_id = message_thread_id + else: + reply_to_msg_id = reply_to_message_id + reply_to = raw.types.InputReplyToMessage(reply_to_msg_id=reply_to_msg_id, top_msg_id=top_msg_id) + try: if isinstance(sticker, str): if os.path.isfile(sticker): @@ -159,7 +173,7 @@ async def send_sticker( peer=await self.resolve_peer(chat_id), media=media, silent=disable_notification or None, - reply_to_msg_id=reply_to_message_id or message_thread_id, + reply_to=reply_to, random_id=self.rnd_id(), schedule_date=utils.datetime_to_timestamp(schedule_date), noforwards=protect_content, diff --git a/pyrogram/methods/messages/send_venue.py b/pyrogram/methods/messages/send_venue.py index ff3b59201..2428749bc 100644 --- a/pyrogram/methods/messages/send_venue.py +++ b/pyrogram/methods/messages/send_venue.py @@ -106,6 +106,21 @@ async def send_venue( "me", latitude, longitude, "Venue title", "Venue address") """ + + reply_to = None + if reply_to_message_id or message_thread_id: + reply_to_msg_id = None + top_msg_id = None + if message_thread_id: + if not reply_to_message_id: + reply_to_msg_id = message_thread_id + else: + reply_to_msg_id = reply_to_message_id + top_msg_id = message_thread_id + else: + reply_to_msg_id = reply_to_message_id + reply_to = raw.types.InputReplyToMessage(reply_to_msg_id=reply_to_msg_id, top_msg_id=top_msg_id) + r = await self.invoke( raw.functions.messages.SendMedia( peer=await self.resolve_peer(chat_id), @@ -122,7 +137,7 @@ async def send_venue( ), message="", silent=disable_notification or None, - reply_to_msg_id=reply_to_message_id or message_thread_id, + reply_to=reply_to, random_id=self.rnd_id(), schedule_date=utils.datetime_to_timestamp(schedule_date), noforwards=protect_content, diff --git a/pyrogram/methods/messages/send_video.py b/pyrogram/methods/messages/send_video.py index 088b85ab8..e79b3e9fb 100644 --- a/pyrogram/methods/messages/send_video.py +++ b/pyrogram/methods/messages/send_video.py @@ -185,6 +185,20 @@ async def progress(current, total): """ file = None + reply_to = None + if reply_to_message_id or message_thread_id: + reply_to_msg_id = None + top_msg_id = None + if message_thread_id: + if not reply_to_message_id: + reply_to_msg_id = message_thread_id + else: + reply_to_msg_id = reply_to_message_id + top_msg_id = message_thread_id + else: + reply_to_msg_id = reply_to_message_id + reply_to = raw.types.InputReplyToMessage(reply_to_msg_id=reply_to_msg_id, top_msg_id=top_msg_id) + try: if isinstance(video, str): if os.path.isfile(video): @@ -241,7 +255,7 @@ async def progress(current, total): peer=await self.resolve_peer(chat_id), media=media, silent=disable_notification or None, - reply_to_msg_id=reply_to_message_id or message_thread_id, + reply_to=reply_to, random_id=self.rnd_id(), schedule_date=utils.datetime_to_timestamp(schedule_date), noforwards=protect_content, diff --git a/pyrogram/methods/messages/send_video_note.py b/pyrogram/methods/messages/send_video_note.py index 1348d3fe8..e5f7bf0e6 100644 --- a/pyrogram/methods/messages/send_video_note.py +++ b/pyrogram/methods/messages/send_video_note.py @@ -139,6 +139,20 @@ async def send_video_note( """ file = None + reply_to = None + if reply_to_message_id or message_thread_id: + reply_to_msg_id = None + top_msg_id = None + if message_thread_id: + if not reply_to_message_id: + reply_to_msg_id = message_thread_id + else: + reply_to_msg_id = reply_to_message_id + top_msg_id = message_thread_id + else: + reply_to_msg_id = reply_to_message_id + reply_to = raw.types.InputReplyToMessage(reply_to_msg_id=reply_to_msg_id, top_msg_id=top_msg_id) + try: if isinstance(video_note, str): if os.path.isfile(video_note): @@ -183,7 +197,7 @@ async def send_video_note( peer=await self.resolve_peer(chat_id), media=media, silent=disable_notification or None, - reply_to_msg_id=reply_to_message_id or message_thread_id, + reply_to=reply_to, random_id=self.rnd_id(), schedule_date=utils.datetime_to_timestamp(schedule_date), noforwards=protect_content, diff --git a/pyrogram/methods/messages/send_voice.py b/pyrogram/methods/messages/send_voice.py index a623711cd..e9923466f 100644 --- a/pyrogram/methods/messages/send_voice.py +++ b/pyrogram/methods/messages/send_voice.py @@ -144,6 +144,20 @@ async def send_voice( """ file = None + reply_to = None + if reply_to_message_id or message_thread_id: + reply_to_msg_id = None + top_msg_id = None + if message_thread_id: + if not reply_to_message_id: + reply_to_msg_id = message_thread_id + else: + reply_to_msg_id = reply_to_message_id + top_msg_id = message_thread_id + else: + reply_to_msg_id = reply_to_message_id + reply_to = raw.types.InputReplyToMessage(reply_to_msg_id=reply_to_msg_id, top_msg_id=top_msg_id) + try: if isinstance(voice, str): if os.path.isfile(voice): @@ -184,7 +198,7 @@ async def send_voice( peer=await self.resolve_peer(chat_id), media=media, silent=disable_notification or None, - reply_to_msg_id=reply_to_message_id or message_thread_id, + reply_to=reply_to, random_id=self.rnd_id(), schedule_date=utils.datetime_to_timestamp(schedule_date), noforwards=protect_content,