From 4b477e5b27c2e8747fca6958d0c1b8ead421e7f9 Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Fri, 4 Feb 2022 11:52:04 +0100 Subject: [PATCH] Add some missing filters --- telethon/_events/filters/messages.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/telethon/_events/filters/messages.py b/telethon/_events/filters/messages.py index a6bacbd6..e1b1c3a3 100644 --- a/telethon/_events/filters/messages.py +++ b/telethon/_events/filters/messages.py @@ -2,6 +2,24 @@ import re from .base import Filter +class Incoming: + """ + The update must be something the client received from another user, + and not something the current user sent. + """ + def __call__(self, event): + return not event.out + + +class Outgoing: + """ + The update must be something the current user sent, + and not something received from another user. + """ + def __call__(self, event): + return event.out + + class Pattern: """ The update type must match the specified instances for the filter to return `True`.