Don't get full channel on iter_participants unless necessary

This commit is contained in:
Lonami Exo 2018-04-14 12:08:50 +02:00
parent 4da7df6349
commit 88597f0da8

View File

@ -1247,11 +1247,14 @@ class TelegramClient(TelegramBareClient):
limit = float('inf') if limit is None else int(limit) limit = float('inf') if limit is None else int(limit)
if isinstance(entity, InputPeerChannel): if isinstance(entity, InputPeerChannel):
if _total or (aggressive and not filter):
total = self(GetFullChannelRequest( total = self(GetFullChannelRequest(
entity entity
)).full_chat.participants_count )).full_chat.participants_count
if _total: if _total:
_total[0] = total _total[0] = total
else:
total = 0
if limit == 0: if limit == 0:
return return