diff --git a/pyrogram/client/message_parser.py b/pyrogram/client/message_parser.py index 83d56009..b81d649e 100644 --- a/pyrogram/client/message_parser.py +++ b/pyrogram/client/message_parser.py @@ -476,7 +476,8 @@ def parse_message( document=document, views=message.views, via_bot=parse_user(users.get(message.via_bot_id, None)), - outgoing=message.out + outgoing=message.out, + client=client ) if message.reply_to_msg_id and replies: @@ -575,7 +576,8 @@ def parse_message_service( migrate_to_chat_id=int("-100" + str(migrate_to_chat_id)) if migrate_to_chat_id else None, migrate_from_chat_id=-migrate_from_chat_id if migrate_from_chat_id else None, group_chat_created=group_chat_created, - channel_chat_created=channel_chat_created + channel_chat_created=channel_chat_created, + client=client # TODO: supergroup_chat_created ) @@ -590,4 +592,4 @@ def parse_message_empty( client, message: types.MessageEmpty ) -> pyrogram_types.Message: - return pyrogram_types.Message(message_id=message.id) + return pyrogram_types.Message(message_id=message.id, client=client) diff --git a/pyrogram/client/types/message.py b/pyrogram/client/types/message.py index ea254090..dff5a6a9 100644 --- a/pyrogram/client/types/message.py +++ b/pyrogram/client/types/message.py @@ -30,6 +30,9 @@ class Message(Object): Args: message_id (``int``): Unique message identifier inside this chat. + + client (:obj:`Client `, *optional*): + The client instance this message is bound to. date (``int``, *optional*): Date the message was sent in Unix time. @@ -177,17 +180,17 @@ class Message(Object): via_bot (:obj:`User `): Via bot. - outgoing (``bool``): + outgoing (``bool``, *optional*): Whether the message is incoming or outgoing. Messages received from other chats are incoming (*outgoing* is False). Messages sent from yourself to other chats are outgoing (*outgoing* is True). An exception is made for your own personal chat; messages sent there will be incoming. - matches (``list``): + matches (``list``, *optional*): A list containing all `Match Objects `_ that match the text of this message. Only applicable when using :obj:`Filters.regex `. - command (``list``): + command (``list``, *optional*): A list containing the command and its arguments, if any. E.g.: "/start 1 2 3" would produce ["start", "1", "2", "3"]. Only applicable when using :obj:`Filters.command `. @@ -196,6 +199,7 @@ class Message(Object): def __init__( self, message_id: int, + client=None, date: int = None, chat=None, from_user=None, @@ -244,6 +248,7 @@ class Message(Object): command: list = None ): self.message_id = message_id # int + self.client = client self.date = date # int self.chat = chat # Chat self.from_user = from_user # flags.0?User