From 4e293f23a92de671a39b801f02256ec9dca04799 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Fri, 14 Sep 2018 15:28:08 +0200 Subject: [PATCH] Make handlers test whether filters are callable and not if they exist --- pyrogram/client/handlers/callback_query_handler.py | 2 +- pyrogram/client/handlers/deleted_messages_handler.py | 2 +- pyrogram/client/handlers/message_handler.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pyrogram/client/handlers/callback_query_handler.py b/pyrogram/client/handlers/callback_query_handler.py index c5346519..5d09f7d9 100644 --- a/pyrogram/client/handlers/callback_query_handler.py +++ b/pyrogram/client/handlers/callback_query_handler.py @@ -49,6 +49,6 @@ class CallbackQueryHandler(Handler): def check(self, callback_query): return ( self.filters(callback_query) - if self.filters + if callable(self.filters) else True ) diff --git a/pyrogram/client/handlers/deleted_messages_handler.py b/pyrogram/client/handlers/deleted_messages_handler.py index 55d5715f..8f5ef448 100644 --- a/pyrogram/client/handlers/deleted_messages_handler.py +++ b/pyrogram/client/handlers/deleted_messages_handler.py @@ -50,6 +50,6 @@ class DeletedMessagesHandler(Handler): def check(self, messages): return ( self.filters(messages.messages[0]) - if self.filters + if callable(self.filters) else True ) diff --git a/pyrogram/client/handlers/message_handler.py b/pyrogram/client/handlers/message_handler.py index 1b4770b3..e4c3d13f 100644 --- a/pyrogram/client/handlers/message_handler.py +++ b/pyrogram/client/handlers/message_handler.py @@ -50,6 +50,6 @@ class MessageHandler(Handler): def check(self, message): return ( self.filters(message) - if self.filters + if callable(self.filters) else True )