From fb4e98b0b59807291d1054b6ee44f189163182ca Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Mon, 9 Apr 2018 23:35:51 +0200 Subject: [PATCH] Evaluate filters before dispatching messages --- pyrogram/client/dispatcher/dispatcher.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pyrogram/client/dispatcher/dispatcher.py b/pyrogram/client/dispatcher/dispatcher.py index e1ffe293..957e806b 100644 --- a/pyrogram/client/dispatcher/dispatcher.py +++ b/pyrogram/client/dispatcher/dispatcher.py @@ -99,7 +99,14 @@ class Dispatcher: handler = group.get(key, None) if handler is not None: - args = (self, value, users, chats) if is_raw else (self.client, value) + if is_raw: + args = (self, value, users, chats) + else: + if not handler.check(value): + continue + + args = (self.client, value) + handler.callback(*args) def update_worker(self):