From e69c1867828eb54d51e2d484ef772400833b1255 Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Sat, 7 Apr 2018 12:31:30 +0200 Subject: [PATCH] Support more filter types for convenience (#745) --- telethon/telegram_client.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/telethon/telegram_client.py b/telethon/telegram_client.py index ab5260d2..736b9297 100644 --- a/telethon/telegram_client.py +++ b/telethon/telegram_client.py @@ -84,7 +84,8 @@ from .tl.types import ( InputMessageEntityMentionName, DocumentAttributeVideo, UpdateEditMessage, UpdateEditChannelMessage, UpdateShort, Updates, MessageMediaWebPage, ChannelParticipantsSearch, PhotoSize, PhotoCachedSize, - PhotoSizeEmpty, MessageService, ChatParticipants + PhotoSizeEmpty, MessageService, ChatParticipants, + ChannelParticipantsBanned, ChannelParticipantsKicked ) from .tl.types.messages import DialogsSlice from .tl.types.account import PasswordInputSettings, NoPassword @@ -1211,7 +1212,12 @@ class TelegramClient(TelegramBareClient): or :tl:`ChatParticipants` for normal chats. """ if isinstance(filter, type): - filter = filter() + if filter in (ChannelParticipantsBanned, ChannelParticipantsKicked, + ChannelParticipantsSearch): + # These require a `q` parameter (support types for convenience) + filter = filter('') + else: + filter = filter() entity = self.get_input_entity(entity) if search and (filter or not isinstance(entity, InputPeerChannel)):