How to prevent register_next_step_handler() by @bot.message_handler()?
Hi there! So I have a someone scenario (or steps continuity) in my bot. I need to prevent executing the next step if a command was called. I tried to clear message_subscribers_next_step and _pre_message_subscrubers_next_step. Moreover, I found clear_step_handler() method in branch master. But it doesn't work. Cleaning was processed in @bot.message_handler(), but executing next step continues anyway. How can I solve my problem?
Does anybody help me? I will explain my problem in other words.
I have the /menu handler. This command allows show main menu and set the next step process_menu(). But what if I mistype command name and actually I need /support. So I type /support command and it gives me a choice to the next step depending on the response. Then I type /menu again. In menu handler I wrote the following code:
bot.message_subscribers_next_step[message.chat.id] =
bot.pre_message_subscribers_next_step[message.chat.id] = []
Hence I get 2 callbacks from menu_handler() and process_support_type(). It's known that command handlers works first and I cleaned message_subscribers lists but it doesn't work. Why??? Also I tried to clean TeleBot.worker_pool with close() method in util.ThreadPool but I get error because of I don't understand how all of that work.
@eternnoir @pevdh @MasterGroosha I would be very grateful for any help for my issue.
Install it from master and check.
Hi, may i know how do i implement the exec command handlers? because once i get in a step_handler, there is no way that i could stop it.
@voonfoo98 I suggest implementing a simple finite state machine yourself, it's much more efficient and controlable
@MasterGroosha hey thanks! However, do you have any idea or working examples on how to implement FSM into the bot?
@voonfoo98 I do, but only in Russian: https://groosha.gitbooks.io/telegram-bot-lessons/chapter11.html
There were some fan-made translations into English, though I'm not sure they are complete.
how can I handle registering the next step handler in telebot using a class base in python??
self.bot.register_next_step_handler(msg, self.process_message_custom)
self.bot.register_next_step_handler(msg, self.process_message_custom)
Its not working