diff --git a/pyrogram/filters.py b/pyrogram/filters.py index 45762aee..e9b177ae 100644 --- a/pyrogram/filters.py +++ b/pyrogram/filters.py @@ -70,6 +70,10 @@ class AndFilter(Filter): client, update ) + # short circuit + if not x: + return False + if inspect.iscoroutinefunction(self.other.__call__): y = await self.other(client, update) else: @@ -97,6 +101,10 @@ class OrFilter(Filter): client, update ) + # short circuit + if x: + return True + if inspect.iscoroutinefunction(self.other.__call__): y = await self.other(client, update) else: