mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-03-03 10:45:52 +03:00
Fix incoming = outgoing = True not working
This commit is contained in:
parent
72a04a877f
commit
96742334a4
|
@ -40,13 +40,12 @@ class NewMessage(EventBuilder):
|
|||
def __init__(self, chats=None, *, blacklist_chats=False,
|
||||
incoming=None, outgoing=None,
|
||||
from_users=None, forwards=None, pattern=None):
|
||||
if incoming is not None and outgoing is None:
|
||||
if incoming and outgoing:
|
||||
incoming = outgoing = None # Same as no filter
|
||||
elif incoming is not None and outgoing is None:
|
||||
outgoing = not incoming
|
||||
elif outgoing is not None and incoming is None:
|
||||
incoming = not outgoing
|
||||
|
||||
if incoming and outgoing:
|
||||
self.incoming = self.outgoing = None # Same as no filter
|
||||
elif all(x is not None and not x for x in (incoming, outgoing)):
|
||||
raise ValueError("Don't create an event handler if you "
|
||||
"don't want neither incoming or outgoing!")
|
||||
|
|
Loading…
Reference in New Issue
Block a user