A
A
andrew462020-08-01 21:11:32
Python
andrew46, 2020-08-01 21:11:32

How in a telegram bot, after pressing the Inline button, wait for a response from the user?

I am making a bot on python-telegram-bot. Made an inline keyboard. When you click on the button, the bot displays a message with a list of cases and prompts you to select a case number. How can I make it wait for a response from the user?
Here is the part of the code that fires the button when clicked

if data == CALLBACK_BUTTON1_START:
        choose_list = print_jobs_list(update=update, context=context)
        context.bot.send_message(chat_id=chat_id, text=f"Выберите номер этапа работы?\n{choose_list}")

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrey, 2020-08-01
@anerev

I'm sure google has a lot of info.bot.register_next_step_handler

V
Vladislav the Wise, 2020-08-02
@yungtitanium

I will do this through the ConversationHandler conversation handler.

dialog_handler = ConversationHandler(
    entry_points=[
        CommandHandler('some_command', callback)
        ],
    states={
        'buttons':[
         CallbackQueryHandler(callback)
         ],
     'job_selection':[
     MessageHandler(FIlters.text, callback)
     ],
    },
    fallbacks=[
        CommandHandler('cancel', cancel)
        ]
    )

If you need something, write to me in telegram: t.me/youngtitanium

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question