diff --git a/pyrogram/handlers/callback_query_handler.py b/pyrogram/handlers/callback_query_handler.py index b5fd09d2..75a101ee 100644 --- a/pyrogram/handlers/callback_query_handler.py +++ b/pyrogram/handlers/callback_query_handler.py @@ -98,9 +98,15 @@ class CallbackQueryHandler(Handler): client, query ) - handler_does_match = ( - await self.filters(client, query) if callable(self.filters) else True - ) + if callable(self.filters): + if iscoroutinefunction(self.filters.__call__): + handler_does_match = await self.filters(client, query) + else: + handler_does_match = await client.loop.run_in_executor( + None, self.filters, client, query + ) + else: + handler_does_match = True data = self.compose_data_identifier(query)