diff --git a/pyrogram/methods/bots/send_game.py b/pyrogram/methods/bots/send_game.py index 1194a3ef..a35c6df0 100644 --- a/pyrogram/methods/bots/send_game.py +++ b/pyrogram/methods/bots/send_game.py @@ -78,6 +78,20 @@ class SendGame: 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 @@ class SendGame: ), 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 0df09388..5bc70482 100644 --- a/pyrogram/methods/bots/send_inline_bot_result.py +++ b/pyrogram/methods/bots/send_inline_bot_result.py @@ -53,6 +53,10 @@ class SendInlineBotResult: 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 @@ class SendInlineBotResult: 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 @@ class SendInlineBotResult: 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 52911ea0..f01a14f8 100644 --- a/pyrogram/methods/messages/copy_media_group.py +++ b/pyrogram/methods/messages/copy_media_group.py @@ -31,6 +31,7 @@ class CopyMediaGroup: 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 @@ class CopyMediaGroup: 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 @@ class CopyMediaGroup: 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 @@ class CopyMediaGroup: 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 5699ac55..9e455be5 100644 --- a/pyrogram/methods/messages/copy_message.py +++ b/pyrogram/methods/messages/copy_message.py @@ -113,13 +113,27 @@ class CopyMessage: """ 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 61b62cfa..189fbaac 100644 --- a/pyrogram/methods/messages/send_animation.py +++ b/pyrogram/methods/messages/send_animation.py @@ -180,6 +180,20 @@ class SendAnimation: """ 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 @@ class SendAnimation: 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 1cdc6d5a..212f4331 100644 --- a/pyrogram/methods/messages/send_audio.py +++ b/pyrogram/methods/messages/send_audio.py @@ -174,6 +174,20 @@ class SendAudio: """ 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 @@ class SendAudio: 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 beaf19db..5213a874 100644 --- a/pyrogram/methods/messages/send_cached_media.py +++ b/pyrogram/methods/messages/send_cached_media.py @@ -103,12 +103,26 @@ class SendCachedMedia: 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 32b46835..9be6ca52 100644 --- a/pyrogram/methods/messages/send_contact.py +++ b/pyrogram/methods/messages/send_contact.py @@ -95,6 +95,21 @@ class SendContact: 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 @@ class SendContact: ), 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 f9f7a4d5..92c3d2c8 100644 --- a/pyrogram/methods/messages/send_dice.py +++ b/pyrogram/methods/messages/send_dice.py @@ -95,12 +95,26 @@ class SendDice: 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 e0f4288e..adfd9eb8 100644 --- a/pyrogram/methods/messages/send_document.py +++ b/pyrogram/methods/messages/send_document.py @@ -161,6 +161,20 @@ class SendDocument: """ 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 @@ class SendDocument: 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 dd6079ec..3ae8c88f 100644 --- a/pyrogram/methods/messages/send_location.py +++ b/pyrogram/methods/messages/send_location.py @@ -87,6 +87,21 @@ class SendLocation: 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 @@ class SendLocation: ), 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 16bfbfaa..6a06cc36 100644 --- a/pyrogram/methods/messages/send_media_group.py +++ b/pyrogram/methods/messages/send_media_group.py @@ -99,6 +99,20 @@ class SendMediaGroup: """ 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 @@ class SendMediaGroup: 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 ffc32dd1..14a4d429 100644 --- a/pyrogram/methods/messages/send_message.py +++ b/pyrogram/methods/messages/send_message.py @@ -128,12 +128,26 @@ class SendMessage: 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 d597bf7c..3555a8d6 100644 --- a/pyrogram/methods/messages/send_photo.py +++ b/pyrogram/methods/messages/send_photo.py @@ -152,6 +152,20 @@ class SendPhoto: """ 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 @@ class SendPhoto: 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 106177d7..f384584a 100644 --- a/pyrogram/methods/messages/send_poll.py +++ b/pyrogram/methods/messages/send_poll.py @@ -138,6 +138,20 @@ class SendPoll: 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 @@ class SendPoll: ), 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 6b6d0090..44628e65 100644 --- a/pyrogram/methods/messages/send_sticker.py +++ b/pyrogram/methods/messages/send_sticker.py @@ -125,6 +125,20 @@ class SendSticker: """ 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 @@ class SendSticker: 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 ff3b5920..2428749b 100644 --- a/pyrogram/methods/messages/send_venue.py +++ b/pyrogram/methods/messages/send_venue.py @@ -106,6 +106,21 @@ class SendVenue: "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 @@ class SendVenue: ), 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 088b85ab..e79b3e9f 100644 --- a/pyrogram/methods/messages/send_video.py +++ b/pyrogram/methods/messages/send_video.py @@ -185,6 +185,20 @@ class SendVideo: """ 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 @@ class SendVideo: 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 1348d3fe..e5f7bf0e 100644 --- a/pyrogram/methods/messages/send_video_note.py +++ b/pyrogram/methods/messages/send_video_note.py @@ -139,6 +139,20 @@ class SendVideoNote: """ 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 @@ class SendVideoNote: 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 a623711c..e9923466 100644 --- a/pyrogram/methods/messages/send_voice.py +++ b/pyrogram/methods/messages/send_voice.py @@ -144,6 +144,20 @@ class SendVoice: """ 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 @@ class SendVoice: 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,