Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Let client support next_step_handler to handle message which user replay. #56

Closed
eternnoir opened this issue Jul 27, 2015 · 2 comments
Closed

Comments

@eternnoir
Copy link
Owner

We let bot handle command like '/search google'. It easy to implement by pyTelegramBotAPI.
But if we want split this command to '/search','google' two step. Not that simple now.

So I want to create new method like register_for_new_message. Use them like this:

def process_step1(message):
    if message.text == 'No':
        bot.reply_to(message, "Good bye!")
    else:
        sent_message = bot.send_message(chat_id, "Go to step2?", )
        bot.register_for_new_message(sent_message, process_step2)

def process_step2(message):
    if message.text == 'No':
        bot.reply_to(message, "Good bye!")
    else:
        sent_message = bot.send_message(chat_id, "Go to step3?", )
        bot.register_for_new_message(sent_message, process_step3)

def process_step3(message):
    bot.reply_to(message, "Well done.")

sent_message = bot.send_message(chat_id, "Go to step1?", )
bot.register_for_new_message(sent_message, process_step1)
@pevdh
Copy link
Collaborator

pevdh commented Jul 27, 2015

How are you envisioning this?

@eternnoir
Copy link
Owner Author

@pevdh I pushed a POC implement at feature_next_step_handler branch.
Example:

https://github.com/eternnoir/pyTelegramBotAPI/blob/feature_next_step_handler/examples/step_example.py

eternnoir added a commit that referenced this issue Aug 1, 2015
Change log:
- Some API method change.
- next_step_handler supported. #56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants