From 3c7d3c019613d56b08dbe3a18d75d1b8f137df54 Mon Sep 17 00:00:00 2001 From: coder2020official Date: Sun, 6 Mar 2022 19:52:42 +0500 Subject: [PATCH] Fix tests --- telebot/__init__.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/telebot/__init__.py b/telebot/__init__.py index c00be67..6762af8 100644 --- a/telebot/__init__.py +++ b/telebot/__init__.py @@ -3675,8 +3675,9 @@ class TeleBot: :param message: :return: """ - if self.middlewares: middlewares = [i for i in self.middlewares if update_type in i.update_types] - if not middlewares: return + middlewares = None + if self.middlewares: + middlewares = [i for i in self.middlewares if update_type in i.update_types] return middlewares def _run_middlewares_and_handler(self, message, handlers, middlewares, *args, **kwargs):