Support more filter types for convenience (#745)

This commit is contained in:
Lonami Exo 2018-04-07 12:31:30 +02:00
parent 3b2d065d35
commit e69c186782

View File

@ -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,6 +1212,11 @@ class TelegramClient(TelegramBareClient):
or :tl:`ChatParticipants` for normal chats.
"""
if isinstance(filter, type):
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)