diff --git a/telebot/__init__.py b/telebot/__init__.py index 2204bfa..32ed84d 100644 --- a/telebot/__init__.py +++ b/telebot/__init__.py @@ -1153,14 +1153,17 @@ class TeleBot: while i < len(new_messages): message = new_messages[i] chat_id = message.chat.id + was_poped = False if chat_id in self.next_step_handlers.keys(): handlers = self.next_step_handlers[chat_id] if (handlers): for handler in handlers: self._exec_task(handler["callback"], message, *handler["args"], **handler["kwargs"]) new_messages.pop(i) # removing message that detects with next_step_handler + was_poped = True self.next_step_handlers.pop(chat_id, None) - i += 1 + if (not was_poped): + i += 1 @staticmethod def _build_handler_dict(handler, **filters):