From fb64e143b6e55a325df9c31b7e69d938c95e1c80 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Thu, 30 Dec 2021 13:46:44 +0100 Subject: [PATCH] Add field Message.reactions --- pyrogram/types/messages_and_media/message.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pyrogram/types/messages_and_media/message.py b/pyrogram/types/messages_and_media/message.py index 9e1c7e1a..9306a894 100644 --- a/pyrogram/types/messages_and_media/message.py +++ b/pyrogram/types/messages_and_media/message.py @@ -284,6 +284,9 @@ class Message(Object, Update): Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. + reactions (List of :obj:`~pyrogram.types.Reaction`): + List of the reactions to this message. + link (``str``, *property*): Generate a link to this message, only for groups and channels. """ @@ -361,7 +364,8 @@ class Message(Object, Update): "types.ReplyKeyboardMarkup", "types.ReplyKeyboardRemove", "types.ForceReply" - ] = None + ] = None, + reactions: List["types.Reaction"] = None ): super().__init__(client) @@ -428,6 +432,7 @@ class Message(Object, Update): self.voice_chat_started = voice_chat_started self.voice_chat_ended = voice_chat_ended self.voice_chat_members_invited = voice_chat_members_invited + self.reactions = reactions @staticmethod async def _parse( @@ -721,6 +726,9 @@ class Message(Object, Update): from_user = types.User._parse(client, users.get(user_id, None)) sender_chat = types.Chat._parse(client, message, users, chats, is_chat=False) if not from_user else None + reactions = [types.Reaction(emoji=r.reaction, count=r.count, chosen=r.chosen) + for r in message.reactions.results] if message.reactions else None + parsed_message = Message( message_id=message.id, date=message.date, @@ -780,6 +788,7 @@ class Message(Object, Update): via_bot=types.User._parse(client, users.get(message.via_bot_id, None)), outgoing=message.out, reply_markup=reply_markup, + reactions=reactions, client=client )