From 890bf485c9782991981f70c8bc20e4dee49dec8e Mon Sep 17 00:00:00 2001 From: abcdenis Date: Fri, 14 Mar 2025 17:17:44 +0300 Subject: [PATCH] skip ChannelParticipantLeft in _ParticipantsIter --- telethon/client/chats.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/telethon/client/chats.py b/telethon/client/chats.py index 64f60d5d..e6b2fc25 100644 --- a/telethon/client/chats.py +++ b/telethon/client/chats.py @@ -218,8 +218,10 @@ class _ParticipantsIter(RequestIter): self.requests.offset += len(participants.participants) users = {user.id: user for user in participants.users} for participant in participants.participants: - - if isinstance(participant, types.ChannelParticipantBanned): + if isinstance(participant, types.ChannelParticipantLeft): + # See issue #3231 to learn why this is ignored. + continue + elif isinstance(participant, types.ChannelParticipantBanned): if not isinstance(participant.peer, types.PeerUser): # May have the entire channel banned. See #3105. continue