mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-08-06 13:10:22 +03:00
Use utils.is_list_like and fixed None bug
This commit is contained in:
parent
071ebcb4ef
commit
faf2142122
|
@ -235,11 +235,11 @@ class NewMessage(_EventBuilder):
|
||||||
super().__init__(chats=chats, blacklist_chats=blacklist_chats)
|
super().__init__(chats=chats, blacklist_chats=blacklist_chats)
|
||||||
self.incoming = incoming
|
self.incoming = incoming
|
||||||
self.outgoing = outgoing
|
self.outgoing = outgoing
|
||||||
if isinstance(pattern, str):
|
if pattern is None or utils.is_list_like(pattern):
|
||||||
self.pattern = [re.compile(pattern).match]
|
|
||||||
elif isinstance(pattern, (list, tuple)):
|
|
||||||
self.pattern = pattern
|
self.pattern = pattern
|
||||||
elif not pattern or callable(pattern):
|
elif isinstance(pattern, str):
|
||||||
|
self.pattern = [re.compile(pattern).match]
|
||||||
|
elif callable(pattern):
|
||||||
self.pattern = [pattern]
|
self.pattern = [pattern]
|
||||||
elif hasattr(pattern, 'match') and callable(pattern.match):
|
elif hasattr(pattern, 'match') and callable(pattern.match):
|
||||||
self.pattern = [pattern.match]
|
self.pattern = [pattern.match]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user