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:
parent
a02846e900
commit
490b8bf579
@ -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]
|
||||
|
@ -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
|
||||
)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user