diff --git a/telethon/client/chats.py b/telethon/client/chats.py index b310652d..cb5263fb 100644 --- a/telethon/client/chats.py +++ b/telethon/client/chats.py @@ -37,7 +37,7 @@ class _ParticipantsIter(RequestIter): functions.channels.GetFullChannelRequest(entity) )).full_chat.participants_count - if self.limit == 0: + if self.limit <= 0: raise StopAsyncIteration self.seen = set() diff --git a/telethon/client/dialogs.py b/telethon/client/dialogs.py index 75fbf255..f9782f4d 100644 --- a/telethon/client/dialogs.py +++ b/telethon/client/dialogs.py @@ -18,7 +18,7 @@ class _DialogsIter(RequestIter): hash=0 ) - if self.limit == 0: + if self.limit <= 0: # Special case, get a single dialog and determine count dialogs = await self.client(self.request) self.total = getattr(dialogs, 'count', len(dialogs.dialogs)) diff --git a/telethon/client/messages.py b/telethon/client/messages.py index c14bddeb..d59236d9 100644 --- a/telethon/client/messages.py +++ b/telethon/client/messages.py @@ -111,7 +111,7 @@ class _MessagesIter(RequestIter): hash=0 ) - if self.limit == 0: + if self.limit <= 0: # No messages, but we still need to know the total message count result = await self.client(self.request) if isinstance(result, types.messages.MessagesNotModified):