From e3e84d91e8a43eda0a685148f25d98e8c726771b Mon Sep 17 00:00:00 2001 From: wulan17 Date: Sat, 25 Nov 2023 21:03:43 +0700 Subject: [PATCH] Pyrofork: Add support to reply message in another chat Signed-off-by: wulan17 --- pyrogram/methods/messages/send_animation.py | 15 +- pyrogram/methods/messages/send_audio.py | 15 +- .../methods/messages/send_cached_media.py | 15 +- pyrogram/methods/messages/send_contact.py | 15 +- pyrogram/methods/messages/send_dice.py | 15 +- pyrogram/methods/messages/send_document.py | 15 +- pyrogram/methods/messages/send_location.py | 15 +- pyrogram/methods/messages/send_media_group.py | 15 +- pyrogram/methods/messages/send_message.py | 15 +- pyrogram/methods/messages/send_photo.py | 15 +- pyrogram/methods/messages/send_poll.py | 15 +- pyrogram/methods/messages/send_sticker.py | 15 +- pyrogram/methods/messages/send_venue.py | 15 +- pyrogram/methods/messages/send_video.py | 15 +- pyrogram/methods/messages/send_video_note.py | 15 +- pyrogram/methods/messages/send_voice.py | 15 +- pyrogram/methods/messages/send_web_page.py | 16 +- .../input_reply_to_message.py | 7 + pyrogram/types/messages_and_media/message.py | 224 ++++++++++++++++-- 19 files changed, 453 insertions(+), 34 deletions(-) diff --git a/pyrogram/methods/messages/send_animation.py b/pyrogram/methods/messages/send_animation.py index 9ac75d80..2e552e0f 100644 --- a/pyrogram/methods/messages/send_animation.py +++ b/pyrogram/methods/messages/send_animation.py @@ -50,6 +50,7 @@ class SendAnimation: message_thread_id: int = None, reply_to_message_id: int = None, reply_to_story_id: int = None, + reply_to_chat_id: int = None, quote_text: str = None, schedule_date: datetime = None, protect_content: bool = None, @@ -129,6 +130,10 @@ class SendAnimation: reply_to_story_id (``int``, *optional*): Unique identifier for the target story. + reply_to_chat_id (``int``, *optional*): + Unique identifier for the origin chat. + for reply to message from another chat. + quote_text (``str``, *optional*): Text to quote. for reply_to_message only. @@ -191,8 +196,16 @@ class SendAnimation: file = None reply_to = None + reply_to_chat = None if reply_to_message_id or message_thread_id: - reply_to = types.InputReplyToMessage(reply_to_message_id=reply_to_message_id, message_thread_id=message_thread_id, quote_text=quote_text) + if reply_to_chat_id is not None: + reply_to_chat = await self.resolve_peer(reply_to_chat_id) + reply_to = types.InputReplyToMessage( + reply_to_message_id=reply_to_message_id, + message_thread_id=message_thread_id, + reply_to_chat=reply_to_chat, + quote_text=quote_text + ) if reply_to_story_id: user_id = await self.resolve_peer(chat_id) reply_to = types.InputReplyToStory(user_id=user_id, story_id=reply_to_story_id) diff --git a/pyrogram/methods/messages/send_audio.py b/pyrogram/methods/messages/send_audio.py index 89fe077b..c87bccff 100644 --- a/pyrogram/methods/messages/send_audio.py +++ b/pyrogram/methods/messages/send_audio.py @@ -48,6 +48,7 @@ class SendAudio: message_thread_id: int = None, reply_to_message_id: int = None, reply_to_story_id: int = None, + reply_to_chat_id: int = None, quote_text: str = None, schedule_date: datetime = None, protect_content: bool = None, @@ -122,6 +123,10 @@ class SendAudio: reply_to_story_id (``int``, *optional*): Unique identifier for the target story. + reply_to_chat_id (``int``, *optional*): + Unique identifier for the origin chat. + for reply to message from another chat. + quote_text (``str``, *optional*): Text to quote. for reply_to_message only. @@ -185,8 +190,16 @@ class SendAudio: file = None reply_to = None + reply_to_chat = None if reply_to_message_id or message_thread_id: - reply_to = types.InputReplyToMessage(reply_to_message_id=reply_to_message_id, message_thread_id=message_thread_id, quote_text=quote_text) + if reply_to_chat_id is not None: + reply_to_chat = await self.resolve_peer(reply_to_chat_id) + reply_to = types.InputReplyToMessage( + reply_to_message_id=reply_to_message_id, + message_thread_id=message_thread_id, + reply_to_chat=reply_to_chat, + quote_text=quote_text + ) if reply_to_story_id: user_id = await self.resolve_peer(chat_id) reply_to = types.InputReplyToStory(user_id=user_id, story_id=reply_to_story_id) diff --git a/pyrogram/methods/messages/send_cached_media.py b/pyrogram/methods/messages/send_cached_media.py index 0e155172..582ceec7 100644 --- a/pyrogram/methods/messages/send_cached_media.py +++ b/pyrogram/methods/messages/send_cached_media.py @@ -39,6 +39,7 @@ class SendCachedMedia: message_thread_id: int = None, reply_to_message_id: int = None, reply_to_story_id: int = None, + reply_to_chat_id: int = None, quote_text: str = None, schedule_date: datetime = None, protect_content: bool = None, @@ -94,6 +95,10 @@ class SendCachedMedia: reply_to_story_id (``int``, *optional*): Unique identifier for the target story. + reply_to_chat_id (``int``, *optional*): + Unique identifier for the origin chat. + for reply to message from another chat. + quote_text (``str``, *optional*): Text to quote. for reply_to_message only. @@ -118,8 +123,16 @@ class SendCachedMedia: """ reply_to = None + reply_to_chat = None if reply_to_message_id or message_thread_id: - reply_to = types.InputReplyToMessage(reply_to_message_id=reply_to_message_id, message_thread_id=message_thread_id, quote_text=quote_text) + if reply_to_chat_id is not None: + reply_to_chat = await self.resolve_peer(reply_to_chat_id) + reply_to = types.InputReplyToMessage( + reply_to_message_id=reply_to_message_id, + message_thread_id=message_thread_id, + reply_to_chat=reply_to_chat, + quote_text=quote_text + ) if reply_to_story_id: user_id = await self.resolve_peer(chat_id) reply_to = types.InputReplyToStory(user_id=user_id, story_id=reply_to_story_id) diff --git a/pyrogram/methods/messages/send_contact.py b/pyrogram/methods/messages/send_contact.py index f5d38e10..dbc470d0 100644 --- a/pyrogram/methods/messages/send_contact.py +++ b/pyrogram/methods/messages/send_contact.py @@ -36,6 +36,7 @@ class SendContact: disable_notification: bool = None, message_thread_id: int = None, reply_to_message_id: int = None, + reply_to_chat_id: int = None, quote_text: str = None, schedule_date: datetime = None, protect_content: bool = None, @@ -79,6 +80,10 @@ class SendContact: reply_to_message_id (``int``, *optional*): If the message is a reply, ID of the original message. + reply_to_chat_id (``int``, *optional*): + Unique identifier for the origin chat. + for reply to message from another chat. + quote_text (``str``, *optional*): Text to quote. for reply_to_message only. @@ -103,8 +108,16 @@ class SendContact: """ reply_to = None + reply_to_chat = None if reply_to_message_id or message_thread_id: - reply_to = types.InputReplyToMessage(reply_to_message_id=reply_to_message_id, message_thread_id=message_thread_id, quote_text=quote_text) + if reply_to_chat_id is not None: + reply_to_chat = await self.resolve_peer(reply_to_chat_id) + reply_to = types.InputReplyToMessage( + reply_to_message_id=reply_to_message_id, + message_thread_id=message_thread_id, + reply_to_chat=reply_to_chat, + quote_text=quote_text + ) r = await self.invoke( raw.functions.messages.SendMedia( diff --git a/pyrogram/methods/messages/send_dice.py b/pyrogram/methods/messages/send_dice.py index 7384bdbb..03e83e4f 100644 --- a/pyrogram/methods/messages/send_dice.py +++ b/pyrogram/methods/messages/send_dice.py @@ -34,6 +34,7 @@ class SendDice: message_thread_id: int = None, reply_to_message_id: int = None, reply_to_story_id: int = None, + reply_to_chat_id: int = None, quote_text: str = None, schedule_date: datetime = None, protect_content: bool = None, @@ -75,6 +76,10 @@ class SendDice: reply_to_story_id (``int``, *optional*): Unique identifier for the target story. + reply_to_chat_id (``int``, *optional*): + Unique identifier for the origin chat. + for reply to message from another chat. + quote_text (``str``, *optional*): Text to quote. for reply_to_message only. @@ -106,8 +111,16 @@ class SendDice: """ reply_to = None + reply_to_chat = None if reply_to_message_id or message_thread_id: - reply_to = types.InputReplyToMessage(reply_to_message_id=reply_to_message_id, message_thread_id=message_thread_id, quote_text=quote_text) + if reply_to_chat_id is not None: + reply_to_chat = await self.resolve_peer(reply_to_chat_id) + reply_to = types.InputReplyToMessage( + reply_to_message_id=reply_to_message_id, + message_thread_id=message_thread_id, + reply_to_chat=reply_to_chat, + quote_text=quote_text + ) if reply_to_story_id: user_id = await self.resolve_peer(chat_id) reply_to = types.InputReplyToStory(user_id=user_id, story_id=reply_to_story_id) diff --git a/pyrogram/methods/messages/send_document.py b/pyrogram/methods/messages/send_document.py index 64d21f4d..9c0265f4 100644 --- a/pyrogram/methods/messages/send_document.py +++ b/pyrogram/methods/messages/send_document.py @@ -46,6 +46,7 @@ class SendDocument: message_thread_id: int = None, reply_to_message_id: int = None, reply_to_story_id: int = None, + reply_to_chat_id: int = None, quote_text: str = None, schedule_date: datetime = None, protect_content: bool = None, @@ -114,6 +115,10 @@ class SendDocument: reply_to_story_id (``int``, *optional*): Unique identifier for the target story. + reply_to_chat_id (``int``, *optional*): + Unique identifier for the origin chat. + for reply to message from another chat. + quote_text (``str``, *optional*): Text to quote. for reply_to_message only. @@ -172,8 +177,16 @@ class SendDocument: file = None reply_to = None + reply_to_chat = None if reply_to_message_id or message_thread_id: - reply_to = types.InputReplyToMessage(reply_to_message_id=reply_to_message_id, message_thread_id=message_thread_id, quote_text=quote_text) + if reply_to_chat_id is not None: + reply_to_chat = await self.resolve_peer(reply_to_chat_id) + reply_to = types.InputReplyToMessage( + reply_to_message_id=reply_to_message_id, + message_thread_id=message_thread_id, + reply_to_chat=reply_to_chat, + quote_text=quote_text + ) if reply_to_story_id: user_id = await self.resolve_peer(chat_id) reply_to = types.InputReplyToStory(user_id=user_id, story_id=reply_to_story_id) diff --git a/pyrogram/methods/messages/send_location.py b/pyrogram/methods/messages/send_location.py index d9782427..6de5c2e7 100644 --- a/pyrogram/methods/messages/send_location.py +++ b/pyrogram/methods/messages/send_location.py @@ -34,6 +34,7 @@ class SendLocation: disable_notification: bool = None, message_thread_id: int = None, reply_to_message_id: int = None, + reply_to_chat_id: int = None, quote_text: str = None, schedule_date: datetime = None, protect_content: bool = None, @@ -68,6 +69,10 @@ class SendLocation: Unique identifier for the target message thread (topic) of the forum. for forum supergroups only. + reply_to_chat_id (``int``, *optional*): + Unique identifier for the origin chat. + for reply to message from another chat. + reply_to_message_id (``int``, *optional*): If the message is a reply, ID of the original message @@ -95,8 +100,16 @@ class SendLocation: """ reply_to = None + reply_to_chat = None if reply_to_message_id or message_thread_id: - reply_to = types.InputReplyToMessage(reply_to_message_id=reply_to_message_id, message_thread_id=message_thread_id, quote_text=quote_text) + if reply_to_chat_id is not None: + reply_to_chat = await self.resolve_peer(reply_to_chat_id) + reply_to = types.InputReplyToMessage( + reply_to_message_id=reply_to_message_id, + message_thread_id=message_thread_id, + reply_to_chat=reply_to_chat, + quote_text=quote_text + ) r = await self.invoke( raw.functions.messages.SendMedia( diff --git a/pyrogram/methods/messages/send_media_group.py b/pyrogram/methods/messages/send_media_group.py index 1ff26028..4216921c 100644 --- a/pyrogram/methods/messages/send_media_group.py +++ b/pyrogram/methods/messages/send_media_group.py @@ -49,6 +49,7 @@ class SendMediaGroup: message_thread_id: int = None, reply_to_message_id: int = None, reply_to_story_id: int = None, + reply_to_chat_id: int = None, quote_text: str = None, schedule_date: datetime = None, protect_content: bool = None, @@ -80,6 +81,10 @@ class SendMediaGroup: reply_to_story_id (``int``, *optional*): Unique identifier for the target story. + reply_to_chat_id (``int``, *optional*): + Unique identifier for the origin chat. + for reply to message from another chat. + quote_text (``str``, *optional*): Text to quote. for reply_to_message only. @@ -110,8 +115,16 @@ class SendMediaGroup: multi_media = [] reply_to = None + reply_to_chat = None if reply_to_message_id or message_thread_id: - reply_to = types.InputReplyToMessage(reply_to_message_id=reply_to_message_id, message_thread_id=message_thread_id, quote_text=quote_text) + if reply_to_chat_id is not None: + reply_to_chat = await self.resolve_peer(reply_to_chat_id) + reply_to = types.InputReplyToMessage( + reply_to_message_id=reply_to_message_id, + message_thread_id=message_thread_id, + reply_to_chat=reply_to_chat, + quote_text=quote_text + ) if reply_to_story_id: user_id = await self.resolve_peer(chat_id) reply_to = types.InputReplyToStory(user_id=user_id, story_id=reply_to_story_id) diff --git a/pyrogram/methods/messages/send_message.py b/pyrogram/methods/messages/send_message.py index 5dd071bc..7b12906e 100644 --- a/pyrogram/methods/messages/send_message.py +++ b/pyrogram/methods/messages/send_message.py @@ -37,6 +37,7 @@ class SendMessage: message_thread_id: int = None, reply_to_message_id: int = None, reply_to_story_id: int = None, + reply_to_chat_id: int = None, quote_text: str = None, schedule_date: datetime = None, protect_content: bool = None, @@ -84,6 +85,10 @@ class SendMessage: reply_to_story_id (``int``, *optional*): Unique identifier for the target story. + reply_to_chat_id (``int``, *optional*): + Unique identifier for the origin chat. + for reply to message from another chat. + quote_text (``str``, *optional*): Text to quote. for reply_to_message only. @@ -139,8 +144,16 @@ class SendMessage: message, entities = (await utils.parse_text_entities(self, text, parse_mode, entities)).values() reply_to = None + reply_to_chat = None if reply_to_message_id or message_thread_id: - reply_to = types.InputReplyToMessage(reply_to_message_id=reply_to_message_id, message_thread_id=message_thread_id, quote_text=quote_text) + if reply_to_chat_id is not None: + reply_to_chat = await self.resolve_peer(reply_to_chat_id) + reply_to = types.InputReplyToMessage( + reply_to_message_id=reply_to_message_id, + message_thread_id=message_thread_id, + reply_to_chat=reply_to_chat, + quote_text=quote_text + ) if reply_to_story_id: user_id = await self.resolve_peer(chat_id) reply_to = types.InputReplyToStory(user_id=user_id, story_id=reply_to_story_id) diff --git a/pyrogram/methods/messages/send_photo.py b/pyrogram/methods/messages/send_photo.py index 343aad4d..50b07540 100644 --- a/pyrogram/methods/messages/send_photo.py +++ b/pyrogram/methods/messages/send_photo.py @@ -44,6 +44,7 @@ class SendPhoto: message_thread_id: int = None, reply_to_message_id: int = None, reply_to_story_id: int = None, + reply_to_chat_id: int = None, quote_text: str = None, schedule_date: datetime = None, protect_content: bool = None, @@ -105,6 +106,10 @@ class SendPhoto: reply_to_story_id (``int``, *optional*): Unique identifier for the target story. + reply_to_chat_id (``int``, *optional*): + Unique identifier for the origin chat. + for reply to message from another chat. + quote_text (``str``, *optional*): Text to quote. for reply_to_message only. @@ -163,8 +168,16 @@ class SendPhoto: file = None reply_to = None + reply_to_chat = None if reply_to_message_id or message_thread_id: - reply_to = types.InputReplyToMessage(reply_to_message_id=reply_to_message_id, message_thread_id=message_thread_id, quote_text=quote_text) + if reply_to_chat_id is not None: + reply_to_chat = await self.resolve_peer(reply_to_chat_id) + reply_to = types.InputReplyToMessage( + reply_to_message_id=reply_to_message_id, + message_thread_id=message_thread_id, + reply_to_chat=reply_to_chat, + quote_text=quote_text + ) if reply_to_story_id: user_id = await self.resolve_peer(chat_id) reply_to = types.InputReplyToStory(user_id=user_id, story_id=reply_to_story_id) diff --git a/pyrogram/methods/messages/send_poll.py b/pyrogram/methods/messages/send_poll.py index 75f70f05..ca143a02 100644 --- a/pyrogram/methods/messages/send_poll.py +++ b/pyrogram/methods/messages/send_poll.py @@ -45,6 +45,7 @@ class SendPoll: protect_content: bool = None, message_thread_id: int = None, reply_to_message_id: int = None, + reply_to_chat_id: int = None, quote_text: str = None, schedule_date: datetime = None, reply_markup: Union[ @@ -124,6 +125,10 @@ class SendPoll: reply_to_message_id (``int``, *optional*): If the message is a reply, ID of the original message. + reply_to_chat_id (``int``, *optional*): + Unique identifier for the origin chat. + for reply to message from another chat. + quote_text (``str``, *optional*): Text to quote. for reply_to_message only. @@ -145,8 +150,16 @@ class SendPoll: """ reply_to = None + reply_to_chat = None if reply_to_message_id or message_thread_id: - reply_to = types.InputReplyToMessage(reply_to_message_id=reply_to_message_id, message_thread_id=message_thread_id, quote_text=quote_text) + if reply_to_chat_id is not None: + reply_to_chat = await self.resolve_peer(reply_to_chat_id) + reply_to = types.InputReplyToMessage( + reply_to_message_id=reply_to_message_id, + message_thread_id=message_thread_id, + reply_to_chat=reply_to_chat, + quote_text=quote_text + ) solution, solution_entities = (await utils.parse_text_entities( self, explanation, explanation_parse_mode, explanation_entities diff --git a/pyrogram/methods/messages/send_sticker.py b/pyrogram/methods/messages/send_sticker.py index 428c4ad7..c39e5f8e 100644 --- a/pyrogram/methods/messages/send_sticker.py +++ b/pyrogram/methods/messages/send_sticker.py @@ -40,6 +40,7 @@ class SendSticker: message_thread_id: int = None, reply_to_message_id: int = None, reply_to_story_id: int = None, + reply_to_chat_id: int = None, quote_text: str = None, schedule_date: datetime = None, protect_content: bool = None, @@ -83,6 +84,10 @@ class SendSticker: reply_to_story_id (``int``, *optional*): Unique identifier for the target story. + reply_to_chat_id (``int``, *optional*): + Unique identifier for the origin chat. + for reply to message from another chat. + quote_text (``str``, *optional*): Text to quote. for reply_to_message only. @@ -136,8 +141,16 @@ class SendSticker: file = None reply_to = None + reply_to_chat = None if reply_to_message_id or message_thread_id: - reply_to = types.InputReplyToMessage(reply_to_message_id=reply_to_message_id, message_thread_id=message_thread_id, quote_text=quote_text) + if reply_to_chat_id is not None: + reply_to_chat = await self.resolve_peer(reply_to_chat_id) + reply_to = types.InputReplyToMessage( + reply_to_message_id=reply_to_message_id, + message_thread_id=message_thread_id, + reply_to_chat=reply_to_chat, + quote_text=quote_text + ) if reply_to_story_id: user_id = await self.resolve_peer(chat_id) reply_to = types.InputReplyToStory(user_id=user_id, story_id=reply_to_story_id) diff --git a/pyrogram/methods/messages/send_venue.py b/pyrogram/methods/messages/send_venue.py index 1d90c8a9..ea43d700 100644 --- a/pyrogram/methods/messages/send_venue.py +++ b/pyrogram/methods/messages/send_venue.py @@ -38,6 +38,7 @@ class SendVenue: disable_notification: bool = None, message_thread_id: int = None, reply_to_message_id: int = None, + reply_to_chat_id: int = None, quote_text: str = None, schedule_date: datetime = None, protect_content: bool = None, @@ -88,6 +89,10 @@ class SendVenue: reply_to_message_id (``int``, *optional*): If the message is a reply, ID of the original message + reply_to_chat_id (``int``, *optional*): + Unique identifier for the origin chat. + for reply to message from another chat. + quote_text (``str``, *optional*): Text to quote. for reply_to_message only. @@ -114,8 +119,16 @@ class SendVenue: """ reply_to = None + reply_to_chat = None if reply_to_message_id or message_thread_id: - reply_to = types.InputReplyToMessage(reply_to_message_id=reply_to_message_id, message_thread_id=message_thread_id, quote_text=quote_text) + if reply_to_chat_id is not None: + reply_to_chat = await self.resolve_peer(reply_to_chat_id) + reply_to = types.InputReplyToMessage( + reply_to_message_id=reply_to_message_id, + message_thread_id=message_thread_id, + reply_to_chat=reply_to_chat, + quote_text=quote_text + ) r = await self.invoke( raw.functions.messages.SendMedia( diff --git a/pyrogram/methods/messages/send_video.py b/pyrogram/methods/messages/send_video.py index b144bd82..12d50af7 100644 --- a/pyrogram/methods/messages/send_video.py +++ b/pyrogram/methods/messages/send_video.py @@ -51,6 +51,7 @@ class SendVideo: message_thread_id: int = None, reply_to_message_id: int = None, reply_to_story_id: int = None, + reply_to_chat_id: int = None, quote_text: str = None, schedule_date: datetime = None, protect_content: bool = None, @@ -135,6 +136,10 @@ class SendVideo: reply_to_story_id (``int``, *optional*): Unique identifier for the target story. + reply_to_chat_id (``int``, *optional*): + Unique identifier for the origin chat. + for reply to message from another chat. + quote_text (``str``, *optional*): Text to quote. for reply_to_message only. @@ -196,8 +201,16 @@ class SendVideo: file = None reply_to = None + reply_to_chat = None if reply_to_message_id or message_thread_id: - reply_to = types.InputReplyToMessage(reply_to_message_id=reply_to_message_id, message_thread_id=message_thread_id, quote_text=quote_text) + if reply_to_chat_id is not None: + reply_to_chat = await self.resolve_peer(reply_to_chat_id) + reply_to = types.InputReplyToMessage( + reply_to_message_id=reply_to_message_id, + message_thread_id=message_thread_id, + reply_to_chat=reply_to_chat, + quote_text=quote_text + ) if reply_to_story_id: user_id = await self.resolve_peer(chat_id) reply_to = types.InputReplyToStory(user_id=user_id, story_id=reply_to_story_id) diff --git a/pyrogram/methods/messages/send_video_note.py b/pyrogram/methods/messages/send_video_note.py index 8106aff6..24c7b55d 100644 --- a/pyrogram/methods/messages/send_video_note.py +++ b/pyrogram/methods/messages/send_video_note.py @@ -42,6 +42,7 @@ class SendVideoNote: message_thread_id: int = None, reply_to_message_id: int = None, reply_to_story_id: int = None, + reply_to_chat_id: int = None, quote_text: str = None, schedule_date: datetime = None, protect_content: bool = None, @@ -97,6 +98,10 @@ class SendVideoNote: reply_to_story_id (``int``, *optional*): Unique identifier for the target story. + reply_to_chat_id (``int``, *optional*): + Unique identifier for the origin chat. + for reply to message from another chat. + quote_text (``str``, *optional*): Text to quote. for reply_to_message only. @@ -150,8 +155,16 @@ class SendVideoNote: file = None reply_to = None + reply_to_chat = None if reply_to_message_id or message_thread_id: - reply_to = types.InputReplyToMessage(reply_to_message_id=reply_to_message_id, message_thread_id=message_thread_id, quote_text=quote_text) + if reply_to_chat_id is not None: + reply_to_chat = await self.resolve_peer(reply_to_chat_id) + reply_to = types.InputReplyToMessage( + reply_to_message_id=reply_to_message_id, + message_thread_id=message_thread_id, + reply_to_chat=reply_to_chat, + quote_text=quote_text + ) if reply_to_story_id: user_id = await self.resolve_peer(chat_id) reply_to = types.InputReplyToStory(user_id=user_id, story_id=reply_to_story_id) diff --git a/pyrogram/methods/messages/send_voice.py b/pyrogram/methods/messages/send_voice.py index 2226bb4f..49da4cb5 100644 --- a/pyrogram/methods/messages/send_voice.py +++ b/pyrogram/methods/messages/send_voice.py @@ -44,6 +44,7 @@ class SendVoice: message_thread_id: int = None, reply_to_message_id: int = None, reply_to_story_id: int = None, + reply_to_chat_id: int = None, quote_text: str = None, schedule_date: datetime = None, protect_content: bool = None, @@ -103,6 +104,10 @@ class SendVoice: reply_to_story_id (``int``, *optional*): Unique identifier for the target story. + reply_to_chat_id (``int``, *optional*): + Unique identifier for the origin chat. + for reply to message from another chat. + quote_text (``str``, *optional*): Text to quote. for reply_to_message only. @@ -158,8 +163,16 @@ class SendVoice: file = None reply_to = None + reply_to_chat = None if reply_to_message_id or message_thread_id: - reply_to = types.InputReplyToMessage(reply_to_message_id=reply_to_message_id, message_thread_id=message_thread_id, quote_text=quote_text) + if reply_to_chat_id is not None: + reply_to_chat = await self.resolve_peer(reply_to_chat_id) + reply_to = types.InputReplyToMessage( + reply_to_message_id=reply_to_message_id, + message_thread_id=message_thread_id, + reply_to_chat=reply_to_chat, + quote_text=quote_text + ) if reply_to_story_id: user_id = await self.resolve_peer(chat_id) reply_to = types.InputReplyToStory(user_id=user_id, story_id=reply_to_story_id) diff --git a/pyrogram/methods/messages/send_web_page.py b/pyrogram/methods/messages/send_web_page.py index c9107374..d37d2af9 100644 --- a/pyrogram/methods/messages/send_web_page.py +++ b/pyrogram/methods/messages/send_web_page.py @@ -32,13 +32,13 @@ class SendWebPage: text: str = "", parse_mode: Optional["enums.ParseMode"] = None, entities: List["types.MessageEntity"] = None, - disable_web_page_preview: bool = None, large_media: bool = None, invert_media: bool = None, disable_notification: bool = None, message_thread_id: int = None, reply_to_message_id: int = None, reply_to_story_id: int = None, + reply_to_chat_id: int = None, quote_text: str = None, schedule_date: datetime = None, protect_content: bool = None, @@ -92,6 +92,10 @@ class SendWebPage: reply_to_story_id (``int``, *optional*): Unique identifier for the target story. + reply_to_chat_id (``int``, *optional*): + Unique identifier for the origin chat. + for reply to message from another chat. + quote_text (``str``, *optional*): Text to quote. for reply_to_message only. @@ -119,8 +123,16 @@ class SendWebPage: message, entities = (await utils.parse_text_entities(self, text, parse_mode, entities)).values() reply_to = None + reply_to_chat = None if reply_to_message_id or message_thread_id: - reply_to = types.InputReplyToMessage(reply_to_message_id=reply_to_message_id, message_thread_id=message_thread_id, quote_text=quote_text) + if reply_to_chat_id is not None: + reply_to_chat = await self.resolve_peer(reply_to_chat_id) + reply_to = types.InputReplyToMessage( + reply_to_message_id=reply_to_message_id, + message_thread_id=message_thread_id, + reply_to_chat=reply_to_chat, + quote_text=quote_text + ) if reply_to_story_id: user_id = await self.resolve_peer(chat_id) reply_to = types.InputReplyToStory(user_id=user_id, story_id=reply_to_story_id) diff --git a/pyrogram/types/input_message_content/input_reply_to_message.py b/pyrogram/types/input_message_content/input_reply_to_message.py index 6b27034a..1e1a0098 100644 --- a/pyrogram/types/input_message_content/input_reply_to_message.py +++ b/pyrogram/types/input_message_content/input_reply_to_message.py @@ -18,6 +18,7 @@ from pyrogram import raw from ..object import Object +from typing import Union class InputReplyToMessage(Object): @@ -37,12 +38,17 @@ class InputReplyToMessage(Object): self, *, reply_to_message_id: int = None, message_thread_id: int = None, + reply_to_chat: Union[ + "raw.types.InputPeerChannel", + "raw.types.InputPeerUser" + ] = None, quote_text: str = None ): super().__init__() self.reply_to_message_id = reply_to_message_id self.message_thread_id = message_thread_id + self.reply_to_chat = reply_to_chat self.quote_text = quote_text def write(self): @@ -60,6 +66,7 @@ class InputReplyToMessage(Object): return raw.types.InputReplyToMessage( reply_to_msg_id=reply_to_msg_id, top_msg_id=top_msg_id, + reply_to_peer_id=self.reply_to_chat, quote_text=self.quote_text ).write() return None diff --git a/pyrogram/types/messages_and_media/message.py b/pyrogram/types/messages_and_media/message.py index 45fdcce3..8df53e5c 100644 --- a/pyrogram/types/messages_and_media/message.py +++ b/pyrogram/types/messages_and_media/message.py @@ -1097,6 +1097,7 @@ class Message(Object, Update): disable_web_page_preview: bool = None, disable_notification: bool = None, reply_to_message_id: int = None, + reply_in_chat_id: int = None, quote_text: str = None, schedule_date: datetime = None, protect_content: bool = None, @@ -1147,6 +1148,10 @@ class Message(Object, Update): reply_to_message_id (``int``, *optional*): If the message is a reply, ID of the original message. + reply_in_chat_id (``int``, *optional*): + Unique identifier of target chat. + for reply message in another chat. + quote_text (``str``, *optional*): Text to quote. for reply_to_message only. @@ -1178,8 +1183,14 @@ class Message(Object, Update): if self.message_thread_id: message_thread_id = self.message_thread_id + chat_id = self.chat.id + reply_to_chat_id = None + if reply_in_chat_id is not None: + chat_id = reply_in_chat_id + reply_to_chat_id = self.chat.id + return await self._client.send_message( - chat_id=self.chat.id, + chat_id=chat_id, text=text, parse_mode=parse_mode, entities=entities, @@ -1187,6 +1198,7 @@ class Message(Object, Update): disable_notification=disable_notification, message_thread_id=message_thread_id, reply_to_message_id=reply_to_message_id, + reply_to_chat_id=reply_to_chat_id, quote_text=quote_text, schedule_date=schedule_date, protect_content=protect_content, @@ -1216,6 +1228,7 @@ class Message(Object, Update): "types.ForceReply" ] = None, reply_to_message_id: int = None, + reply_in_chat_id: int = None, quote_text: str = None, progress: Callable = None, progress_args: tuple = () @@ -1287,6 +1300,10 @@ class Message(Object, Update): reply_to_message_id (``int``, *optional*): If the message is a reply, ID of the original message. + reply_in_chat_id (``int``, *optional*): + Unique identifier of target chat. + for reply message in another chat. + quote_text (``str``, *optional*): Text to quote. for reply_to_message only. @@ -1335,8 +1352,14 @@ class Message(Object, Update): if self.message_thread_id: message_thread_id = self.message_thread_id + chat_id = self.chat.id + reply_to_chat_id = None + if reply_in_chat_id is not None: + chat_id = reply_in_chat_id + reply_to_chat_id = self.chat.id + return await self._client.send_animation( - chat_id=self.chat.id, + chat_id=chat_id, animation=animation, caption=caption, parse_mode=parse_mode, @@ -1350,6 +1373,7 @@ class Message(Object, Update): disable_notification=disable_notification, message_thread_id=message_thread_id, reply_to_message_id=reply_to_message_id, + reply_to_chat_id=reply_to_chat_id, quote_text=quote_text, reply_markup=reply_markup, progress=progress, @@ -1370,6 +1394,7 @@ class Message(Object, Update): file_name: str = None, disable_notification: bool = None, reply_to_message_id: int = None, + reply_in_chat_id: int = None, quote_text: str = None, reply_markup: Union[ "types.InlineKeyboardMarkup", @@ -1444,6 +1469,10 @@ class Message(Object, Update): reply_to_message_id (``int``, *optional*): If the message is a reply, ID of the original message. + reply_in_chat_id (``int``, *optional*): + Unique identifier of target chat. + for reply message in another chat. + quote_text (``str``, *optional*): Text to quote. for reply_to_message only. @@ -1492,8 +1521,14 @@ class Message(Object, Update): if self.message_thread_id: message_thread_id = self.message_thread_id + chat_id = self.chat.id + reply_to_chat_id = None + if reply_in_chat_id is not None: + chat_id = reply_in_chat_id + reply_to_chat_id = self.chat.id + return await self._client.send_audio( - chat_id=self.chat.id, + chat_id=chat_id, audio=audio, caption=caption, parse_mode=parse_mode, @@ -1506,6 +1541,7 @@ class Message(Object, Update): disable_notification=disable_notification, message_thread_id=message_thread_id, reply_to_message_id=reply_to_message_id, + reply_to_chat_id=reply_to_chat_id, quote_text=quote_text, reply_markup=reply_markup, progress=progress, @@ -1521,6 +1557,7 @@ class Message(Object, Update): caption_entities: List["types.MessageEntity"] = None, disable_notification: bool = None, reply_to_message_id: int = None, + reply_in_chat_id: int = None, quote_text: str = None, reply_markup: Union[ "types.InlineKeyboardMarkup", @@ -1572,6 +1609,10 @@ class Message(Object, Update): reply_to_message_id (``int``, *optional*): If the message is a reply, ID of the original message. + reply_in_chat_id (``int``, *optional*): + Unique identifier of target chat. + for reply message in another chat. + quote_text (``str``, *optional*): Text to quote. for reply_to_message only. @@ -1596,8 +1637,14 @@ class Message(Object, Update): if self.message_thread_id: message_thread_id = self.message_thread_id + chat_id = self.chat.id + reply_to_chat_id = None + if reply_in_chat_id is not None: + chat_id = reply_in_chat_id + reply_to_chat_id = self.chat.id + return await self._client.send_cached_media( - chat_id=self.chat.id, + chat_id=chat_id, file_id=file_id, caption=caption, parse_mode=parse_mode, @@ -1605,6 +1652,7 @@ class Message(Object, Update): disable_notification=disable_notification, message_thread_id=message_thread_id, reply_to_message_id=reply_to_message_id, + reply_to_chat_id=reply_to_chat_id, quote_text=quote_text, reply_markup=reply_markup ) @@ -1655,6 +1703,7 @@ class Message(Object, Update): vcard: str = "", disable_notification: bool = None, reply_to_message_id: int = None, + reply_in_chat_id: int = None, quote_text: str = None, reply_markup: Union[ "types.InlineKeyboardMarkup", @@ -1705,6 +1754,10 @@ class Message(Object, Update): reply_to_message_id (``int``, *optional*): If the message is a reply, ID of the original message. + reply_in_chat_id (``int``, *optional*): + Unique identifier of target chat. + for reply message in another chat. + quote_text (``str``, *optional*): Text to quote. for reply_to_message only. @@ -1729,8 +1782,14 @@ class Message(Object, Update): if self.message_thread_id: message_thread_id = self.message_thread_id + chat_id = self.chat.id + reply_to_chat_id = None + if reply_in_chat_id is not None: + chat_id = reply_in_chat_id + reply_to_chat_id = self.chat.id + return await self._client.send_contact( - chat_id=self.chat.id, + chat_id=chat_id, phone_number=phone_number, first_name=first_name, last_name=last_name, @@ -1738,6 +1797,7 @@ class Message(Object, Update): disable_notification=disable_notification, message_thread_id=message_thread_id, reply_to_message_id=reply_to_message_id, + reply_to_chat_id=reply_to_chat_id, quote_text=quote_text, reply_markup=reply_markup ) @@ -1754,6 +1814,7 @@ class Message(Object, Update): force_document: bool = None, disable_notification: bool = None, reply_to_message_id: int = None, + reply_in_chat_id: int = None, quote_text: str = None, schedule_date: datetime = None, reply_markup: Union[ @@ -1825,6 +1886,10 @@ class Message(Object, Update): reply_to_message_id (``int``, *optional*): If the message is a reply, ID of the original message. + reply_in_chat_id (``int``, *optional*): + Unique identifier of target chat. + for reply message in another chat. + quote_text (``str``, *optional*): Text to quote. for reply_to_message only. @@ -1876,8 +1941,14 @@ class Message(Object, Update): if self.message_thread_id: message_thread_id = self.message_thread_id + chat_id = self.chat.id + reply_to_chat_id = None + if reply_in_chat_id is not None: + chat_id = reply_in_chat_id + reply_to_chat_id = self.chat.id + return await self._client.send_document( - chat_id=self.chat.id, + chat_id=chat_id, document=document, thumb=thumb, caption=caption, @@ -1888,6 +1959,7 @@ class Message(Object, Update): disable_notification=disable_notification, message_thread_id=message_thread_id, reply_to_message_id=reply_to_message_id, + reply_to_chat_id=reply_to_chat_id, quote_text=quote_text, schedule_date=schedule_date, reply_markup=reply_markup, @@ -2051,6 +2123,7 @@ class Message(Object, Update): quote: bool = None, disable_notification: bool = None, reply_to_message_id: int = None, + reply_in_chat_id: int = None, quote_text: str = None, reply_markup: Union[ "types.InlineKeyboardMarkup", @@ -2095,6 +2168,10 @@ class Message(Object, Update): reply_to_message_id (``int``, *optional*): If the message is a reply, ID of the original message + reply_in_chat_id (``int``, *optional*): + Unique identifier of target chat. + for reply message in another chat. + quote_text (``str``, *optional*): Text to quote. for reply_to_message only. @@ -2119,13 +2196,20 @@ class Message(Object, Update): if self.message_thread_id: message_thread_id = self.message_thread_id + chat_id = self.chat.id + reply_to_chat_id = None + if reply_in_chat_id is not None: + chat_id = reply_in_chat_id + reply_to_chat_id = self.chat.id + return await self._client.send_location( - chat_id=self.chat.id, + chat_id=chat_id, latitude=latitude, longitude=longitude, disable_notification=disable_notification, message_thread_id=message_thread_id, reply_to_message_id=reply_to_message_id, + reply_to_chat_id=reply_to_chat_id, quote_text=quote_text, reply_markup=reply_markup ) @@ -2141,6 +2225,7 @@ class Message(Object, Update): quote: bool = None, disable_notification: bool = None, reply_to_message_id: int = None, + reply_in_chat_id: int = None, quote_text: str = None ) -> List["types.Message"]: """Bound method *reply_media_group* of :obj:`~pyrogram.types.Message`. @@ -2177,6 +2262,10 @@ class Message(Object, Update): reply_to_message_id (``int``, *optional*): If the message is a reply, ID of the original message. + reply_in_chat_id (``int``, *optional*): + Unique identifier of target chat. + for reply message in another chat. + quote_text (``str``, *optional*): Text to quote. for reply_to_message only. @@ -2198,12 +2287,19 @@ class Message(Object, Update): if self.message_thread_id: message_thread_id = self.message_thread_id + chat_id = self.chat.id + reply_to_chat_id = None + if reply_in_chat_id is not None: + chat_id = reply_in_chat_id + reply_to_chat_id = self.chat.id + return await self._client.send_media_group( - chat_id=self.chat.id, + chat_id=chat_id, media=media, disable_notification=disable_notification, message_thread_id=message_thread_id, reply_to_message_id=reply_to_message_id, + reply_to_chat_id=reply_to_chat_id, quote_text=quote_text ) @@ -2218,6 +2314,7 @@ class Message(Object, Update): ttl_seconds: int = None, disable_notification: bool = None, reply_to_message_id: int = None, + reply_in_chat_id: int = None, quote_text: str = None, reply_markup: Union[ "types.InlineKeyboardMarkup", @@ -2281,6 +2378,10 @@ class Message(Object, Update): reply_to_message_id (``int``, *optional*): If the message is a reply, ID of the original message. + reply_in_chat_id (``int``, *optional*): + Unique identifier of target chat. + for reply message in another chat. + quote_text (``str``, *optional*): Text to quote. for reply_to_message only. @@ -2329,8 +2430,14 @@ class Message(Object, Update): if self.message_thread_id: message_thread_id = self.message_thread_id + chat_id = self.chat.id + reply_to_chat_id = None + if reply_in_chat_id is not None: + chat_id = reply_in_chat_id + reply_to_chat_id = self.chat.id + return await self._client.send_photo( - chat_id=self.chat.id, + chat_id=chat_id, photo=photo, caption=caption, parse_mode=parse_mode, @@ -2340,6 +2447,7 @@ class Message(Object, Update): disable_notification=disable_notification, message_thread_id=message_thread_id, reply_to_message_id=reply_to_message_id, + reply_to_chat_id=reply_to_chat_id, quote_text=quote_text, reply_markup=reply_markup, progress=progress, @@ -2364,6 +2472,7 @@ class Message(Object, Update): disable_notification: bool = None, protect_content: bool = None, reply_to_message_id: int = None, + reply_in_chat_id: int = None, quote_text: str = None, schedule_date: datetime = None, reply_markup: Union[ @@ -2452,6 +2561,10 @@ class Message(Object, Update): reply_to_message_id (``int``, *optional*): If the message is a reply, ID of the original message. + reply_in_chat_id (``int``, *optional*): + Unique identifier of target chat. + for reply message in another chat. + quote_text (``str``, *optional*): Text to quote. for reply_to_message only. @@ -2479,8 +2592,14 @@ class Message(Object, Update): if self.message_thread_id: message_thread_id = self.message_thread_id + chat_id = self.chat.id + reply_to_chat_id = None + if reply_in_chat_id is not None: + chat_id = reply_in_chat_id + reply_to_chat_id = self.chat.id + return await self._client.send_poll( - chat_id=self.chat.id, + chat_id=chat_id, question=question, options=options, is_anonymous=is_anonymous, @@ -2497,6 +2616,7 @@ class Message(Object, Update): protect_content=protect_content, message_thread_id=message_thread_id, reply_to_message_id=reply_to_message_id, + reply_to_chat_id=reply_to_chat_id, quote_text=quote_text, schedule_date=schedule_date, reply_markup=reply_markup @@ -2508,6 +2628,7 @@ class Message(Object, Update): quote: bool = None, disable_notification: bool = None, reply_to_message_id: int = None, + reply_in_chat_id: int = None, quote_text: str = None, reply_markup: Union[ "types.InlineKeyboardMarkup", @@ -2553,6 +2674,10 @@ class Message(Object, Update): reply_to_message_id (``int``, *optional*): If the message is a reply, ID of the original message. + reply_in_chat_id (``int``, *optional*): + Unique identifier of target chat. + for reply message in another chat. + quote_text (``str``, *optional*): Text to quote. for reply_to_message only. @@ -2601,12 +2726,19 @@ class Message(Object, Update): if self.message_thread_id: message_thread_id = self.message_thread_id + chat_id = self.chat.id + reply_to_chat_id = None + if reply_in_chat_id is not None: + chat_id = reply_in_chat_id + reply_to_chat_id = self.chat.id + return await self._client.send_sticker( - chat_id=self.chat.id, + chat_id=chat_id, sticker=sticker, disable_notification=disable_notification, message_thread_id=message_thread_id, reply_to_message_id=reply_to_message_id, + reply_to_chat_id=reply_to_chat_id, quote_text=quote_text, reply_markup=reply_markup, progress=progress, @@ -2624,6 +2756,7 @@ class Message(Object, Update): foursquare_type: str = "", disable_notification: bool = None, reply_to_message_id: int = None, + reply_in_chat_id: int = None, quote_text: str = None, reply_markup: Union[ "types.InlineKeyboardMarkup", @@ -2683,6 +2816,10 @@ class Message(Object, Update): reply_to_message_id (``int``, *optional*): If the message is a reply, ID of the original message + reply_in_chat_id (``int``, *optional*): + Unique identifier of target chat. + for reply message in another chat. + quote_text (``str``, *optional*): Text to quote. for reply_to_message only. @@ -2707,8 +2844,14 @@ class Message(Object, Update): if self.message_thread_id: message_thread_id = self.message_thread_id + chat_id = self.chat.id + reply_to_chat_id = None + if reply_in_chat_id is not None: + chat_id = reply_in_chat_id + reply_to_chat_id = self.chat.id + return await self._client.send_venue( - chat_id=self.chat.id, + chat_id=chat_id, latitude=latitude, longitude=longitude, title=title, @@ -2718,6 +2861,7 @@ class Message(Object, Update): disable_notification=disable_notification, message_thread_id=message_thread_id, reply_to_message_id=reply_to_message_id, + reply_to_chat_id=reply_to_chat_id, quote_text=quote_text, reply_markup=reply_markup ) @@ -2739,6 +2883,7 @@ class Message(Object, Update): supports_streaming: bool = True, disable_notification: bool = None, reply_to_message_id: int = None, + reply_in_chat_id: int = None, quote_text: str = None, reply_markup: Union[ "types.InlineKeyboardMarkup", @@ -2824,6 +2969,10 @@ class Message(Object, Update): reply_to_message_id (``int``, *optional*): If the message is a reply, ID of the original message. + reply_in_chat_id (``int``, *optional*): + Unique identifier of target chat. + for reply message in another chat. + quote_text (``str``, *optional*): Text to quote. for reply_to_message only. @@ -2872,8 +3021,14 @@ class Message(Object, Update): if self.message_thread_id: message_thread_id = self.message_thread_id + chat_id = self.chat.id + reply_to_chat_id = None + if reply_in_chat_id is not None: + chat_id = reply_in_chat_id + reply_to_chat_id = self.chat.id + return await self._client.send_video( - chat_id=self.chat.id, + chat_id=chat_id, video=video, caption=caption, parse_mode=parse_mode, @@ -2889,6 +3044,7 @@ class Message(Object, Update): disable_notification=disable_notification, message_thread_id=message_thread_id, reply_to_message_id=reply_to_message_id, + reply_to_chat_id=reply_to_chat_id, quote_text=quote_text, reply_markup=reply_markup, progress=progress, @@ -2904,6 +3060,7 @@ class Message(Object, Update): thumb: Union[str, BinaryIO] = None, disable_notification: bool = None, reply_to_message_id: int = None, + reply_in_chat_id: int = None, quote_text: str = None, reply_markup: Union[ "types.InlineKeyboardMarkup", @@ -2961,6 +3118,10 @@ class Message(Object, Update): reply_to_message_id (``int``, *optional*): If the message is a reply, ID of the original message + reply_in_chat_id (``int``, *optional*): + Unique identifier of target chat. + for reply message in another chat. + quote_text (``str``, *optional*): Text to quote. for reply_to_message only. @@ -3009,8 +3170,14 @@ class Message(Object, Update): if self.message_thread_id: message_thread_id = self.message_thread_id + chat_id = self.chat.id + reply_to_chat_id = None + if reply_in_chat_id is not None: + chat_id = reply_in_chat_id + reply_to_chat_id = self.chat.id + return await self._client.send_video_note( - chat_id=self.chat.id, + chat_id=chat_id, video_note=video_note, duration=duration, length=length, @@ -3018,6 +3185,7 @@ class Message(Object, Update): disable_notification=disable_notification, message_thread_id=message_thread_id, reply_to_message_id=reply_to_message_id, + reply_to_chat_id=reply_to_chat_id, quote_text=quote_text, reply_markup=reply_markup, progress=progress, @@ -3034,6 +3202,7 @@ class Message(Object, Update): duration: int = 0, disable_notification: bool = None, reply_to_message_id: int = None, + reply_in_chat_id: int = None, quote_text: str = None, reply_markup: Union[ "types.InlineKeyboardMarkup", @@ -3092,6 +3261,10 @@ class Message(Object, Update): reply_to_message_id (``int``, *optional*): If the message is a reply, ID of the original message + reply_in_chat_id (``int``, *optional*): + Unique identifier of target chat. + for reply message in another chat. + quote_text (``str``, *optional*): Text to quote. for reply_to_message only. @@ -3140,8 +3313,14 @@ class Message(Object, Update): if self.message_thread_id: message_thread_id = self.message_thread_id + chat_id = self.chat.id + reply_to_chat_id = None + if reply_in_chat_id is not None: + chat_id = reply_in_chat_id + reply_to_chat_id = self.chat.id + return await self._client.send_voice( - chat_id=self.chat.id, + chat_id=chat_id, voice=voice, caption=caption, parse_mode=parse_mode, @@ -3150,6 +3329,7 @@ class Message(Object, Update): disable_notification=disable_notification, message_thread_id=message_thread_id, reply_to_message_id=reply_to_message_id, + reply_to_chat_id=reply_to_chat_id, quote_text=quote_text, reply_markup=reply_markup, progress=progress, @@ -3166,6 +3346,7 @@ class Message(Object, Update): invert_media: bool = None, disable_notification: bool = None, reply_to_message_id: int = None, + reply_in_chat_id: int = None, quote_text: str = None, schedule_date: datetime = None, protect_content: bool = None, @@ -3220,6 +3401,10 @@ class Message(Object, Update): reply_to_message_id (``int``, *optional*): If the message is a reply, ID of the original message. + reply_in_chat_id (``int``, *optional*): + Unique identifier of target chat. + for reply message in another chat. + quote_text (``str``, *optional*): Text to quote. for reply_to_message only. @@ -3251,8 +3436,14 @@ class Message(Object, Update): if self.message_thread_id: message_thread_id = self.message_thread_id + chat_id = self.chat.id + reply_to_chat_id = None + if reply_in_chat_id is not None: + chat_id = reply_in_chat_id + reply_to_chat_id = self.chat.id + return await self._client.send_web_page( - chat_id=self.chat.id, + chat_id=chat_id, url=url, text=text, parse_mode=parse_mode, @@ -3262,6 +3453,7 @@ class Message(Object, Update): disable_notification=disable_notification, message_thread_id=message_thread_id, reply_to_message_id=reply_to_message_id, + reply_to_chat_id=reply_to_chat_id, quote_text=quote_text, schedule_date=schedule_date, protect_content=protect_content,