From 2a642b237721e282e6f0ba2b995311a1c826cdd6 Mon Sep 17 00:00:00 2001 From: KurimuzonAkuma Date: Fri, 24 Nov 2023 15:55:25 +0300 Subject: [PATCH] Make reply bound methods send to the same topic --- pyrogram/types/messages_and_media/message.py | 51 ++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/pyrogram/types/messages_and_media/message.py b/pyrogram/types/messages_and_media/message.py index 0c4313bb..0d346f8f 100644 --- a/pyrogram/types/messages_and_media/message.py +++ b/pyrogram/types/messages_and_media/message.py @@ -1205,6 +1205,9 @@ class Message(Object, Update): if reply_to_message_id is None and quote: reply_to_message_id = self.id + if message_thread_id is None: + message_thread_id = self.message_thread_id + return await self._client.send_message( chat_id=self.chat.id, text=text, @@ -1361,6 +1364,9 @@ class Message(Object, Update): if reply_to_message_id is None and quote: reply_to_message_id = self.id + if message_thread_id is None: + message_thread_id = self.message_thread_id + return await self._client.send_animation( chat_id=self.chat.id, animation=animation, @@ -1516,6 +1522,9 @@ class Message(Object, Update): if reply_to_message_id is None and quote: reply_to_message_id = self.id + if message_thread_id is None: + message_thread_id = self.message_thread_id + return await self._client.send_audio( chat_id=self.chat.id, audio=audio, @@ -1623,6 +1632,9 @@ class Message(Object, Update): if reply_to_message_id is None and quote: reply_to_message_id = self.id + if message_thread_id is None: + message_thread_id = self.message_thread_id + return await self._client.send_cached_media( chat_id=self.chat.id, file_id=file_id, @@ -1765,6 +1777,9 @@ class Message(Object, Update): if reply_to_message_id is None and quote: reply_to_message_id = self.id + if message_thread_id is None: + message_thread_id = self.message_thread_id + return await self._client.send_contact( chat_id=self.chat.id, phone_number=phone_number, @@ -1921,6 +1936,9 @@ class Message(Object, Update): if reply_to_message_id is None and quote: reply_to_message_id = self.id + if message_thread_id is None: + message_thread_id = self.message_thread_id + return await self._client.send_document( chat_id=self.chat.id, document=document, @@ -2006,6 +2024,9 @@ class Message(Object, Update): if reply_to_message_id is None and quote: reply_to_message_id = self.id + if message_thread_id is None: + message_thread_id = self.message_thread_id + return await self._client.send_game( chat_id=self.chat.id, game_short_name=game_short_name, @@ -2088,6 +2109,9 @@ class Message(Object, Update): if reply_to_message_id is None and quote: reply_to_message_id = self.id + if message_thread_id is None: + message_thread_id = self.message_thread_id + return await self._client.send_inline_bot_result( chat_id=self.chat.id, query_id=query_id, @@ -2178,6 +2202,9 @@ class Message(Object, Update): if reply_to_message_id is None and quote: reply_to_message_id = self.id + if message_thread_id is None: + message_thread_id = self.message_thread_id + return await self._client.send_location( chat_id=self.chat.id, latitude=latitude, @@ -2261,6 +2288,9 @@ class Message(Object, Update): if reply_to_message_id is None and quote: reply_to_message_id = self.id + if message_thread_id is None: + message_thread_id = self.message_thread_id + return await self._client.send_media_group( chat_id=self.chat.id, media=media, @@ -2397,6 +2427,9 @@ class Message(Object, Update): if reply_to_message_id is None and quote: reply_to_message_id = self.id + if message_thread_id is None: + message_thread_id = self.message_thread_id + return await self._client.send_photo( chat_id=self.chat.id, photo=photo, @@ -2556,6 +2589,9 @@ class Message(Object, Update): if reply_to_message_id is None and quote: reply_to_message_id = self.id + if message_thread_id is None: + message_thread_id = self.message_thread_id + return await self._client.send_poll( chat_id=self.chat.id, question=question, @@ -2688,6 +2724,9 @@ class Message(Object, Update): if reply_to_message_id is None and quote: reply_to_message_id = self.id + if message_thread_id is None: + message_thread_id = self.message_thread_id + return await self._client.send_sticker( chat_id=self.chat.id, sticker=sticker, @@ -2804,6 +2843,9 @@ class Message(Object, Update): if reply_to_message_id is None and quote: reply_to_message_id = self.id + if message_thread_id is None: + message_thread_id = self.message_thread_id + return await self._client.send_venue( chat_id=self.chat.id, latitude=latitude, @@ -2969,6 +3011,9 @@ class Message(Object, Update): if reply_to_message_id is None and quote: reply_to_message_id = self.id + if message_thread_id is None: + message_thread_id = self.message_thread_id + return await self._client.send_video( chat_id=self.chat.id, video=video, @@ -3114,6 +3159,9 @@ class Message(Object, Update): if reply_to_message_id is None and quote: reply_to_message_id = self.id + if message_thread_id is None: + message_thread_id = self.message_thread_id + return await self._client.send_video_note( chat_id=self.chat.id, video_note=video_note, @@ -3250,6 +3298,9 @@ class Message(Object, Update): if reply_to_message_id is None and quote: reply_to_message_id = self.id + if message_thread_id is None: + message_thread_id = self.message_thread_id + return await self._client.send_voice( chat_id=self.chat.id, voice=voice,