Update iter_chat_members efficiency
This commit is contained in:
parent
c0a5b0a2c3
commit
44deabf399
@ -126,3 +126,6 @@ class BaseClient:
|
||||
|
||||
def get_chat_members(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
def get_chat_members_count(self, *args, **kwargs):
|
||||
pass
|
||||
|
@ -81,9 +81,14 @@ 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)
|
||||
|
||||
filter = (
|
||||
Filters.RECENT
|
||||
if self.get_chat_members_count(chat_id) <= 10000 and filter == Filters.ALL
|
||||
else filter
|
||||
)
|
||||
|
||||
if filter not in QUERYABLE_FILTERS:
|
||||
queries = [""]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user