Skip to content
This repository was archived by the owner on Dec 23, 2024. It is now read-only.
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix Message.reactions type-hint error
  • Loading branch information
kvrvgv committed May 5, 2023
commit cf2629f5d39afc90d35fc5eb4fbfa563111e6e8d
14 changes: 10 additions & 4 deletions pyrogram/types/messages_and_media/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ class Message(Object, Update):
views (``int``, *optional*):
Channel post views.

forwards (``int``, *optional*):
forwards (``int``, *optional*):
Channel post forwards.

via_bot (:obj:`~pyrogram.types.User`):
Expand Down Expand Up @@ -384,7 +384,7 @@ def __init__(
"types.ReplyKeyboardRemove",
"types.ForceReply"
] = None,
reactions: List["types.Reaction"] = None
reactions: Union[List["types.Reaction"], "types.MessageReactions"] = None
):
super().__init__(client)

Expand Down Expand Up @@ -456,7 +456,13 @@ def __init__(
self.video_chat_ended = video_chat_ended
self.video_chat_members_invited = video_chat_members_invited
self.web_app_data = web_app_data
self.reactions = reactions
self._reactions = reactions

@property

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

изображение

def reactions(self) -> Optional["types.MessageReactions"]:
if isinstance(self._reactions, types.MessageReactions):
return self._reactions
return None

@staticmethod
async def _parse(
Expand Down Expand Up @@ -756,7 +762,7 @@ async def _parse(
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.MessageReactions._parse(client, message.reactions)
reactions = types.MessageReactions._parse(client, message._reactions)

parsed_message = Message(
id=message.id,
Expand Down