mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-10 19:46:36 +03:00
Support more filter types for convenience (#745)
This commit is contained in:
parent
3b2d065d35
commit
e69c186782
|
@ -84,7 +84,8 @@ from .tl.types import (
|
||||||
InputMessageEntityMentionName, DocumentAttributeVideo,
|
InputMessageEntityMentionName, DocumentAttributeVideo,
|
||||||
UpdateEditMessage, UpdateEditChannelMessage, UpdateShort, Updates,
|
UpdateEditMessage, UpdateEditChannelMessage, UpdateShort, Updates,
|
||||||
MessageMediaWebPage, ChannelParticipantsSearch, PhotoSize, PhotoCachedSize,
|
MessageMediaWebPage, ChannelParticipantsSearch, PhotoSize, PhotoCachedSize,
|
||||||
PhotoSizeEmpty, MessageService, ChatParticipants
|
PhotoSizeEmpty, MessageService, ChatParticipants,
|
||||||
|
ChannelParticipantsBanned, ChannelParticipantsKicked
|
||||||
)
|
)
|
||||||
from .tl.types.messages import DialogsSlice
|
from .tl.types.messages import DialogsSlice
|
||||||
from .tl.types.account import PasswordInputSettings, NoPassword
|
from .tl.types.account import PasswordInputSettings, NoPassword
|
||||||
|
@ -1211,7 +1212,12 @@ class TelegramClient(TelegramBareClient):
|
||||||
or :tl:`ChatParticipants` for normal chats.
|
or :tl:`ChatParticipants` for normal chats.
|
||||||
"""
|
"""
|
||||||
if isinstance(filter, type):
|
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)
|
entity = self.get_input_entity(entity)
|
||||||
if search and (filter or not isinstance(entity, InputPeerChannel)):
|
if search and (filter or not isinstance(entity, InputPeerChannel)):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user