diff --git a/compiler/docs/compiler.py b/compiler/docs/compiler.py index 635a431e..07bab4fd 100644 --- a/compiler/docs/compiler.py +++ b/compiler/docs/compiler.py @@ -715,6 +715,7 @@ def pyrogram_api(): InputMessageContent InputMessageContent InputReplyToMessage + InputReplyToMonoforum InputReplyToStory InputTextMessageContent InputLocationMessageContent diff --git a/pyrogram/methods/messages/send_animation.py b/pyrogram/methods/messages/send_animation.py index 99c67749..f77244cd 100644 --- a/pyrogram/methods/messages/send_animation.py +++ b/pyrogram/methods/messages/send_animation.py @@ -52,6 +52,7 @@ class SendAnimation: reply_to_message_id: int = None, reply_to_story_id: int = None, reply_to_chat_id: Union[int, str] = None, + reply_to_monoforum_id: Union[int, str] = None, quote_text: str = None, quote_entities: List["types.MessageEntity"] = None, schedule_date: datetime = None, @@ -145,6 +146,11 @@ class SendAnimation: for reply to message from another chat. You can also use chat public link in form of *t.me/* (str). + reply_to_monoforum_id (``int`` | ``str``, *optional*): + Unique identifier for the target user of monoforum. + for reply to message from monoforum. + for channel administrators only. + quote_text (``str``, *optional*): Text to quote. for reply_to_message only. @@ -226,6 +232,7 @@ class SendAnimation: reply_to_story_id=reply_to_story_id, message_thread_id=message_thread_id, reply_to_chat_id=reply_to_chat_id, + reply_to_monoforum_id=reply_to_monoforum_id, quote_text=quote_text, quote_entities=quote_entities, parse_mode=parse_mode diff --git a/pyrogram/methods/messages/send_audio.py b/pyrogram/methods/messages/send_audio.py index 967958e0..752dee58 100644 --- a/pyrogram/methods/messages/send_audio.py +++ b/pyrogram/methods/messages/send_audio.py @@ -50,6 +50,7 @@ class SendAudio: reply_to_message_id: int = None, reply_to_story_id: int = None, reply_to_chat_id: Union[int, str] = None, + reply_to_monoforum_id: Union[int, str] = None, quote_text: str = None, quote_entities: List["types.MessageEntity"] = None, message_effect_id: int = None, @@ -137,6 +138,11 @@ class SendAudio: for reply to message from another chat. You can also use chat public link in form of *t.me/* (str). + reply_to_monoforum_id (``int`` | ``str``, *optional*): + Unique identifier for the target user of monoforum. + for reply to message from monoforum. + for channel administrators only. + quote_text (``str``, *optional*): Text to quote. for reply_to_message only. @@ -216,6 +222,7 @@ class SendAudio: reply_to_story_id=reply_to_story_id, message_thread_id=message_thread_id, reply_to_chat_id=reply_to_chat_id, + reply_to_monoforum_id=reply_to_monoforum_id, quote_text=quote_text, quote_entities=quote_entities, parse_mode=parse_mode diff --git a/pyrogram/methods/messages/send_cached_media.py b/pyrogram/methods/messages/send_cached_media.py index 8fc8071c..05875f52 100644 --- a/pyrogram/methods/messages/send_cached_media.py +++ b/pyrogram/methods/messages/send_cached_media.py @@ -40,6 +40,7 @@ class SendCachedMedia: reply_to_message_id: int = None, reply_to_story_id: int = None, reply_to_chat_id: Union[int, str] = None, + reply_to_monoforum_id: Union[int, str] = None, quote_text: str = None, quote_entities: List["types.MessageEntity"] = None, schedule_date: datetime = None, @@ -104,6 +105,11 @@ class SendCachedMedia: for reply to message from another chat. You can also use chat public link in form of *t.me/* (str). + reply_to_monoforum_id (``int`` | ``str``, *optional*): + Unique identifier for the target user of monoforum. + for reply to message from monoforum. + for channel administrators only. + quote_text (``str``, *optional*): Text to quote. for reply_to_message only. @@ -144,6 +150,7 @@ class SendCachedMedia: reply_to_story_id=reply_to_story_id, message_thread_id=message_thread_id, reply_to_chat_id=reply_to_chat_id, + reply_to_monoforum_id=reply_to_monoforum_id, quote_text=quote_text, quote_entities=quote_entities, parse_mode=parse_mode diff --git a/pyrogram/methods/messages/send_contact.py b/pyrogram/methods/messages/send_contact.py index c50d03bd..bd96d7ef 100644 --- a/pyrogram/methods/messages/send_contact.py +++ b/pyrogram/methods/messages/send_contact.py @@ -38,6 +38,7 @@ class SendContact: business_connection_id: str = None, reply_to_message_id: int = None, reply_to_chat_id: Union[int, str] = None, + reply_to_monoforum_id: Union[int, str] = None, quote_text: str = None, quote_entities: List["types.MessageEntity"] = None, parse_mode: Optional["enums.ParseMode"] = None, @@ -95,6 +96,11 @@ class SendContact: for reply to message from another chat. You can also use chat public link in form of *t.me/* (str). + reply_to_monoforum_id (``int`` | ``str``, *optional*): + Unique identifier for the target user of monoforum. + for reply to message from monoforum. + for channel administrators only. + quote_text (``str``, *optional*): Text to quote. for reply_to_message only. @@ -139,6 +145,7 @@ class SendContact: reply_to_message_id=reply_to_message_id, message_thread_id=message_thread_id, reply_to_chat_id=reply_to_chat_id, + reply_to_monoforum_id=reply_to_monoforum_id, quote_text=quote_text, quote_entities=quote_entities, parse_mode=parse_mode diff --git a/pyrogram/methods/messages/send_dice.py b/pyrogram/methods/messages/send_dice.py index d96025ed..0cd63a11 100644 --- a/pyrogram/methods/messages/send_dice.py +++ b/pyrogram/methods/messages/send_dice.py @@ -36,6 +36,7 @@ class SendDice: reply_to_message_id: int = None, reply_to_story_id: int = None, reply_to_chat_id: Union[int, str] = None, + reply_to_monoforum_id: Union[int, str] = None, quote_text: str = None, quote_entities: List["types.MessageEntity"] = None, parse_mode: Optional["enums.ParseMode"] = None, @@ -91,6 +92,11 @@ class SendDice: for reply to message from another chat. You can also use chat public link in form of *t.me/* (str). + reply_to_monoforum_id (``int`` | ``str``, *optional*): + Unique identifier for the target user of monoforum. + for reply to message from monoforum. + for channel administrators only. + quote_text (``str``, *optional*): Text to quote. for reply_to_message only. @@ -143,6 +149,7 @@ class SendDice: reply_to_story_id=reply_to_story_id, message_thread_id=message_thread_id, reply_to_chat_id=reply_to_chat_id, + reply_to_monoforum_id=reply_to_monoforum_id, quote_text=quote_text, quote_entities=quote_entities, parse_mode=parse_mode diff --git a/pyrogram/methods/messages/send_document.py b/pyrogram/methods/messages/send_document.py index cc29985e..efb1da72 100644 --- a/pyrogram/methods/messages/send_document.py +++ b/pyrogram/methods/messages/send_document.py @@ -48,6 +48,7 @@ class SendDocument: reply_to_message_id: int = None, reply_to_story_id: int = None, reply_to_chat_id: Union[int, str] = None, + reply_to_monoforum_id: Union[int, str] = None, quote_text: str = None, quote_entities: List["types.MessageEntity"] = None, message_effect_id: int = None, @@ -129,6 +130,11 @@ class SendDocument: for reply to message from another chat. You can also use chat public link in form of *t.me/* (str). + reply_to_monoforum_id (``int`` | ``str``, *optional*): + Unique identifier for the target user of monoforum. + for reply to message from monoforum. + for channel administrators only. + quote_text (``str``, *optional*): Text to quote. for reply_to_message only. @@ -203,6 +209,7 @@ class SendDocument: reply_to_story_id=reply_to_story_id, message_thread_id=message_thread_id, reply_to_chat_id=reply_to_chat_id, + reply_to_monoforum_id=reply_to_monoforum_id, quote_text=quote_text, quote_entities=quote_entities, parse_mode=parse_mode diff --git a/pyrogram/methods/messages/send_location.py b/pyrogram/methods/messages/send_location.py index c8621a7d..0138f2a6 100644 --- a/pyrogram/methods/messages/send_location.py +++ b/pyrogram/methods/messages/send_location.py @@ -38,6 +38,7 @@ class SendLocation: business_connection_id: str = None, reply_to_message_id: int = None, reply_to_chat_id: Union[int, str] = None, + reply_to_monoforum_id: Union[int, str] = None, quote_text: str = None, quote_entities: List["types.MessageEntity"] = None, parse_mode: Optional["enums.ParseMode"] = None, @@ -89,6 +90,11 @@ class SendLocation: for reply to message from another chat. You can also use chat public link in form of *t.me/* (str). + reply_to_monoforum_id (``int`` | ``str``, *optional*): + Unique identifier for the target user of monoforum. + for reply to message from monoforum. + for channel administrators only. + reply_to_message_id (``int``, *optional*): If the message is a reply, ID of the original message @@ -136,6 +142,7 @@ class SendLocation: reply_to_message_id=reply_to_message_id, message_thread_id=message_thread_id, reply_to_chat_id=reply_to_chat_id, + reply_to_monoforum_id=reply_to_monoforum_id, quote_text=quote_text, quote_entities=quote_entities, parse_mode=parse_mode diff --git a/pyrogram/methods/messages/send_media_group.py b/pyrogram/methods/messages/send_media_group.py index a6a14021..89867f0b 100644 --- a/pyrogram/methods/messages/send_media_group.py +++ b/pyrogram/methods/messages/send_media_group.py @@ -56,6 +56,7 @@ class SendMediaGroup: reply_to_message_id: int = None, reply_to_story_id: int = None, reply_to_chat_id: Union[int, str] = None, + reply_to_monoforum_id: Union[int, str] = None, quote_text: str = None, quote_entities: List["types.MessageEntity"] = None, parse_mode: Optional["enums.ParseMode"] = None, @@ -104,6 +105,11 @@ class SendMediaGroup: for reply to message from another chat. You can also use chat public link in form of *t.me/* (str). + reply_to_monoforum_id (``int`` | ``str``, *optional*): + Unique identifier for the target user of monoforum. + for reply to message from monoforum. + for channel administrators only. + quote_text (``str``, *optional*): Text to quote. for reply_to_message only. @@ -180,6 +186,7 @@ class SendMediaGroup: reply_to_story_id=reply_to_story_id, message_thread_id=message_thread_id, reply_to_chat_id=reply_to_chat_id, + reply_to_monoforum_id=reply_to_monoforum_id, quote_text=quote_text, quote_entities=quote_entities, parse_mode=parse_mode, diff --git a/pyrogram/methods/messages/send_message.py b/pyrogram/methods/messages/send_message.py index c8547f30..dd12e323 100644 --- a/pyrogram/methods/messages/send_message.py +++ b/pyrogram/methods/messages/send_message.py @@ -39,6 +39,7 @@ class SendMessage: reply_to_message_id: int = None, reply_to_story_id: int = None, reply_to_chat_id: int = None, + reply_to_monoforum_id: Union[int, str] = None, quote_text: str = None, quote_entities: List["types.MessageEntity"] = None, schedule_date: datetime = None, @@ -100,6 +101,11 @@ class SendMessage: for reply to message from another chat. You can also use chat public link in form of *t.me/* (str). + reply_to_monoforum_id (``int`` | ``str``, *optional*): + Unique identifier for the target user of the monoforum. + for reply to message from a monoforum. + for channel administrators only. + quote_text (``str``, *optional*): Text to quote. for reply_to_message only. @@ -174,6 +180,7 @@ class SendMessage: reply_to_story_id=reply_to_story_id, message_thread_id=message_thread_id, reply_to_chat_id=reply_to_chat_id, + reply_to_monoforum_id=reply_to_monoforum_id, quote_text=quote_text, quote_entities=quote_entities, parse_mode=parse_mode diff --git a/pyrogram/methods/messages/send_photo.py b/pyrogram/methods/messages/send_photo.py index 711d893d..be48619a 100644 --- a/pyrogram/methods/messages/send_photo.py +++ b/pyrogram/methods/messages/send_photo.py @@ -46,6 +46,7 @@ class SendPhoto: reply_to_message_id: int = None, reply_to_story_id: int = None, reply_to_chat_id: Union[int, str] = None, + reply_to_monoforum_id: Union[int, str] = None, quote_text: str = None, quote_entities: List["types.MessageEntity"] = None, schedule_date: datetime = None, @@ -122,6 +123,11 @@ class SendPhoto: for reply to message from another chat. You can also use chat public link in form of *t.me/* (str). + reply_to_monoforum_id (``int`` | ``str``, *optional*): + Unique identifier for the target user of monoforum. + for reply to message from monoforum. + for channel administrators only. + quote_text (``str``, *optional*): Text to quote. for reply_to_message only. @@ -203,6 +209,7 @@ class SendPhoto: reply_to_story_id=reply_to_story_id, message_thread_id=message_thread_id, reply_to_chat_id=reply_to_chat_id, + reply_to_monoforum_id=reply_to_monoforum_id, quote_text=quote_text, quote_entities=quote_entities, parse_mode=parse_mode diff --git a/pyrogram/methods/messages/send_sticker.py b/pyrogram/methods/messages/send_sticker.py index f3e60cd2..7af70846 100644 --- a/pyrogram/methods/messages/send_sticker.py +++ b/pyrogram/methods/messages/send_sticker.py @@ -44,6 +44,7 @@ class SendSticker: reply_to_message_id: int = None, reply_to_story_id: int = None, reply_to_chat_id: Union[int, str] = None, + reply_to_monoforum_id: Union[int, str] = None, quote_text: str = None, quote_entities: List["types.MessageEntity"] = None, parse_mode: Optional["enums.ParseMode"] = None, @@ -104,6 +105,11 @@ class SendSticker: for reply to message from another chat. You can also use chat public link in form of *t.me/* (str). + reply_to_monoforum_id (``int`` | ``str``, *optional*): + Unique identifier for the target user of monoforum. + for reply to message from monoforum. + for channel administrators only. + quote_text (``str``, *optional*): Text to quote. for reply_to_message only. @@ -178,6 +184,7 @@ class SendSticker: reply_to_story_id=reply_to_story_id, message_thread_id=message_thread_id, reply_to_chat_id=reply_to_chat_id, + reply_to_monoforum_id=reply_to_monoforum_id, quote_text=quote_text, quote_entities=quote_entities, parse_mode=parse_mode diff --git a/pyrogram/methods/messages/send_video.py b/pyrogram/methods/messages/send_video.py index 5689dc5a..0702f34d 100644 --- a/pyrogram/methods/messages/send_video.py +++ b/pyrogram/methods/messages/send_video.py @@ -50,6 +50,7 @@ class SendVideo: reply_to_message_id: int = None, reply_to_story_id: int = None, reply_to_chat_id: Union[int, str] = None, + reply_to_monoforum_id: Union[int, str] = None, quote_text: str = None, quote_entities: List["types.MessageEntity"] = None, cover: Union[str, BinaryIO] = None, @@ -151,6 +152,11 @@ class SendVideo: for reply to message from another chat. You can also use chat public link in form of *t.me/* (str). + reply_to_monoforum_id (``int`` | ``str``, *optional*): + Unique identifier for the target user of monoforum. + for reply to message from monoforum. + for channel administrators only. + quote_text (``str``, *optional*): Text to quote. for reply_to_message only. @@ -251,6 +257,7 @@ class SendVideo: reply_to_story_id=reply_to_story_id, message_thread_id=message_thread_id, reply_to_chat_id=reply_to_chat_id, + reply_to_monoforum_id=reply_to_monoforum_id, quote_text=quote_text, quote_entities=quote_entities, parse_mode=parse_mode diff --git a/pyrogram/methods/messages/send_video_note.py b/pyrogram/methods/messages/send_video_note.py index aa0a8def..bea7380e 100644 --- a/pyrogram/methods/messages/send_video_note.py +++ b/pyrogram/methods/messages/send_video_note.py @@ -45,6 +45,7 @@ class SendVideoNote: reply_to_message_id: int = None, reply_to_story_id: int = None, reply_to_chat_id: Union[int, str] = None, + reply_to_monoforum_id: Union[int, str] = None, quote_text: str = None, quote_entities: List["types.MessageEntity"] = None, parse_mode: Optional["enums.ParseMode"] = None, @@ -118,6 +119,11 @@ class SendVideoNote: for reply to message from another chat. You can also use chat public link in form of *t.me/* (str). + reply_to_monoforum_id (``int`` | ``str``, *optional*): + Unique identifier for the target user of monoforum. + for reply to message from monoforum. + for channel administrators only. + quote_text (``str``, *optional*): Text to quote. for reply_to_message only. @@ -197,6 +203,7 @@ class SendVideoNote: reply_to_story_id=reply_to_story_id, message_thread_id=message_thread_id, reply_to_chat_id=reply_to_chat_id, + reply_to_monoforum_id=reply_to_monoforum_id, quote_text=quote_text, quote_entities=quote_entities, parse_mode=parse_mode diff --git a/pyrogram/methods/messages/send_voice.py b/pyrogram/methods/messages/send_voice.py index 2bcbb0ca..1ec3751b 100644 --- a/pyrogram/methods/messages/send_voice.py +++ b/pyrogram/methods/messages/send_voice.py @@ -46,6 +46,7 @@ class SendVoice: reply_to_message_id: int = None, reply_to_story_id: int = None, reply_to_chat_id: Union[int, str] = None, + reply_to_monoforum_id: Union[int, str] = None, quote_text: str = None, quote_entities: List["types.MessageEntity"] = None, schedule_date: datetime = None, @@ -121,6 +122,11 @@ class SendVoice: for reply to message from another chat. You can also use chat public link in form of *t.me/* (str). + reply_to_monoforum_id (``int`` | ``str``, *optional*): + Unique identifier for the target user of monoforum. + for reply to message from monoforum. + for channel administrators only. + quote_text (``str``, *optional*): Text to quote. for reply_to_message only. @@ -189,6 +195,7 @@ class SendVoice: reply_to_story_id=reply_to_story_id, message_thread_id=message_thread_id, reply_to_chat_id=reply_to_chat_id, + reply_to_monoforum_id=reply_to_monoforum_id, quote_text=quote_text, quote_entities=quote_entities, parse_mode=parse_mode diff --git a/pyrogram/methods/messages/send_web_page.py b/pyrogram/methods/messages/send_web_page.py index be79610e..257b7bd7 100644 --- a/pyrogram/methods/messages/send_web_page.py +++ b/pyrogram/methods/messages/send_web_page.py @@ -39,6 +39,7 @@ class SendWebPage: reply_to_message_id: int = None, reply_to_story_id: int = None, reply_to_chat_id: Union[int, str] = None, + reply_to_monoforum_id: Union[int, str] = None, quote_text: str = None, quote_entities: List["types.MessageEntity"] = None, schedule_date: datetime = None, @@ -106,6 +107,11 @@ class SendWebPage: for reply to message from another chat. You can also use chat public link in form of *t.me/* (str). + reply_to_monoforum_id (``int`` | ``str``, *optional*): + Unique identifier for the target user of monoforum. + for reply to message from monoforum. + for channel administrators only. + quote_text (``str``, *optional*): Text to quote. for reply_to_message only. @@ -161,6 +167,7 @@ class SendWebPage: reply_to_story_id=reply_to_story_id, message_thread_id=message_thread_id, reply_to_chat_id=reply_to_chat_id, + reply_to_monoforum_id=reply_to_monoforum_id, quote_text=quote_text, quote_entities=quote_entities, parse_mode=parse_mode diff --git a/pyrogram/types/input_message_content/__init__.py b/pyrogram/types/input_message_content/__init__.py index 1a271da1..ae897b0d 100644 --- a/pyrogram/types/input_message_content/__init__.py +++ b/pyrogram/types/input_message_content/__init__.py @@ -19,6 +19,7 @@ from .input_message_content import InputMessageContent from .input_reply_to_message import InputReplyToMessage +from .input_reply_to_monoforum import InputReplyToMonoforum from .input_reply_to_story import InputReplyToStory from .input_text_message_content import InputTextMessageContent from .input_location_message_content import InputLocationMessageContent @@ -29,6 +30,7 @@ from .input_invoice_message_content import InputInvoiceMessageContent __all__ = [ "InputMessageContent", "InputReplyToMessage", + "InputReplyToMonoforum", "InputReplyToStory", "InputTextMessageContent", "InputLocationMessageContent", diff --git a/pyrogram/types/input_message_content/input_reply_to_monoforum.py b/pyrogram/types/input_message_content/input_reply_to_monoforum.py new file mode 100644 index 00000000..701e2900 --- /dev/null +++ b/pyrogram/types/input_message_content/input_reply_to_monoforum.py @@ -0,0 +1,43 @@ +# Pyrofork - Telegram MTProto API Client Library for Python +# Copyright (C) 2022-present Mayuri-Chan +# +# This file is part of Pyrofork. +# +# Pyrofork is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published +# by the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Pyrofork is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with Pyrofork. If not, see . + +from pyrogram import raw +from ..object import Object + + +class InputReplyToMonoforum(Object): + """Contains information about a target replied monoforum. + + + Parameters: + monoforum_peer (:obj:`~pyrogram.raw.types.InputPeer`): + An InputPeer. + """ + + def __init__( + self, *, + monoforum_peer: "raw.types.InputPeer" + ): + super().__init__() + + self.monoforum_peer = monoforum_peer + + def write(self): + return raw.types.InputReplyToMonoForum( + monoforum_peer_id=self.monoforum_peer + ).write() diff --git a/pyrogram/utils.py b/pyrogram/utils.py index 4ad6c5c2..fc0e9abd 100644 --- a/pyrogram/utils.py +++ b/pyrogram/utils.py @@ -487,6 +487,7 @@ async def get_reply_to( reply_to_message_id: int = None, reply_to_story_id: int = None, message_thread_id: int = None, + reply_to_monoforum_id: Union[int,str] = None, reply_to_chat_id: Union[int,str] = None, quote_text: str = None, quote_entities: List["types.MessageEntity"] = None, @@ -495,7 +496,12 @@ async def get_reply_to( ): reply_to = None reply_to_chat = None - if reply_to_message_id or message_thread_id: + if reply_to_monoforum_id: + peer = await client.resolve_peer(reply_to_monoforum_id) + reply_to = types.InputReplyToMonoforum( + monoforum_peer=peer + ) + elif reply_to_message_id or message_thread_id: text, entities = (await parse_text_entities(client, quote_text, parse_mode, quote_entities)).values() if reply_to_chat_id is not None: reply_to_chat = await client.resolve_peer(reply_to_chat_id) @@ -507,7 +513,7 @@ async def get_reply_to( quote_entities=entities, quote_offset=quote_offset, ) - if reply_to_story_id: + elif reply_to_story_id: peer = await client.resolve_peer(chat_id) reply_to = types.InputReplyToStory( peer=peer,