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

Fixed middlewares

This commit is contained in:
coder2020official 2022-03-07 21:40:39 +05:00
parent 9f3a270fae
commit 477d02468d

View File

@ -3876,11 +3876,12 @@ class TeleBot:
return
for message in new_messages:
middleware = self._check_middleware(update_type)
if self.use_class_middlewares and middleware:
if self.use_class_middlewares:
middleware = self._check_middleware(update_type)
self._exec_task(self._run_middlewares_and_handler, message, handlers=handlers, middlewares=middleware)
return
for message_handler in handlers:
if self._test_message_handler(message_handler, message):
self._exec_task(message_handler['function'], message, pass_bot=message_handler['pass_bot'], task_type='handler')
break
else:
for message_handler in handlers:
if self._test_message_handler(message_handler, message):
self._exec_task(message_handler['function'], message, pass_bot=message_handler['pass_bot'], task_type='handler')
break