diff --git a/telebot/__init__.py b/telebot/__init__.py index c2ce45c..44dd27b 100644 --- a/telebot/__init__.py +++ b/telebot/__init__.py @@ -1259,10 +1259,13 @@ class TeleBot: def _notify_command_handlers(self, handlers, new_messages): for message in new_messages: - for message_handler in handlers: - if self._test_message_handler(message_handler, message): - self._exec_task(message_handler['function'], message) - break + # if message has next step handler, dont exec command handlers + if (isinstance(message, types.CallbackQuery)) or \ + (isinstance(message, types.Message) and (message.chat.id not in self.message_subscribers_next_step)): + for message_handler in handlers: + if self._test_message_handler(message_handler, message): + self._exec_task(message_handler['function'], message) + break class AsyncTeleBot(TeleBot):