1
0
mirror of https://github.com/eternnoir/pyTelegramBotAPI.git synced 2023-08-10 21:12:57 +03:00

Merge pull request #801 from bedilbek/fix-middleware-invocations

Fix not needed invocations on typed middleware handlers
This commit is contained in:
Badiboy 2020-04-20 11:10:04 +03:00 committed by GitHub
commit 7966def331
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -380,7 +380,7 @@ class TeleBot:
def process_middlewares(self, update): def process_middlewares(self, update):
for update_type, middlewares in self.typed_middleware_handlers.items(): for update_type, middlewares in self.typed_middleware_handlers.items():
if hasattr(update, update_type): if getattr(update, update_type) is not None:
for typed_middleware_handler in middlewares: for typed_middleware_handler in middlewares:
typed_middleware_handler(self, getattr(update, update_type)) typed_middleware_handler(self, getattr(update, update_type))