From 96742334a442915d2c1013bef3250c42f2a5607d Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Sun, 29 Jul 2018 13:03:10 +0200 Subject: [PATCH] Fix incoming = outgoing = True not working --- telethon/events/newmessage.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/telethon/events/newmessage.py b/telethon/events/newmessage.py index ed8f8ecf..e270c094 100644 --- a/telethon/events/newmessage.py +++ b/telethon/events/newmessage.py @@ -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!")