From ff0f9b0e8fe0dc067a2c666517777cc5425cb418 Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Tue, 20 Sep 2022 18:12:29 +0200 Subject: [PATCH] Ignore ChannelParticipantLeft during iter_participants Closes #3231. --- telethon/client/chats.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/telethon/client/chats.py b/telethon/client/chats.py index 3297f2a2..daab610b 100644 --- a/telethon/client/chats.py +++ b/telethon/client/chats.py @@ -155,7 +155,10 @@ class _ParticipantsIter(RequestIter): users = {user.id: user for user in full.users} for participant in full.full_chat.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): user_id = participant.peer.user_id else: user_id = participant.user_id