From 491b96c9f671405fb3b2f9ce3600d3de5603bae4 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Mon, 7 Jan 2019 10:00:42 +0100 Subject: [PATCH] Use "recent" filter for up to 10k members --- pyrogram/client/methods/chats/iter_chat_members.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pyrogram/client/methods/chats/iter_chat_members.py b/pyrogram/client/methods/chats/iter_chat_members.py index bdd8d117..cd93fc46 100644 --- a/pyrogram/client/methods/chats/iter_chat_members.py +++ b/pyrogram/client/methods/chats/iter_chat_members.py @@ -86,6 +86,7 @@ class IterChatMembers(BaseClient): yielded = set() queries = [query] if query else QUERIES total = limit or (1 << 31) - 1 + filter = Filters.RECENT if total <= 10000 and filter == Filters.ALL else filter limit = min(200, total) if filter not in QUERYABLE_FILTERS: