2
0
mirror of https://github.com/pyrogram/pyrogram synced 2025-08-29 05:18:10 +00:00

Fix get_message getting infinite replies

This commit is contained in:
Dan 2018-12-31 12:02:15 +01:00
parent a02846e900
commit 490b8bf579
2 changed files with 3 additions and 3 deletions

View File

@ -78,6 +78,6 @@ class GetMessages(BaseClient):
else:
rpc = functions.messages.GetMessages(id=ids)
messages = pyrogram.Messages._parse(self, self.send(rpc))
messages = pyrogram.Messages._parse(self, self.send(rpc), replies)
return messages if is_iterable else messages.messages[0]

View File

@ -47,13 +47,13 @@ class Messages(PyrogramType):
self.messages = messages
@staticmethod
def _parse(client, messages: types.messages.Messages) -> "Messages":
def _parse(client, messages: types.messages.Messages, replies: int = 1) -> "Messages":
users = {i.id: i for i in messages.users}
chats = {i.id: i for i in messages.chats}
return Messages(
total_count=getattr(messages, "count", len(messages.messages)),
messages=[Message._parse(client, message, users, chats) for message in messages.messages],
messages=[Message._parse(client, message, users, chats, replies) for message in messages.messages],
client=client
)