A
A
AlexAlex2292021-10-29 14:19:14
Python
AlexAlex229, 2021-10-29 14:19:14

How to check inline button click before going to function in pytelegrambotapi?

How to check inline button click before going to function in pytelegrambotapi?
I pass to the function via the (register_next_step_handler) method.

bot.register_next_step_handler(myVariable, endProgrammFUNC)

#myVariable - имя переменной, значение которой я передаю в переходимую функцию

#endProgrammFUNC - собственно сама функция, куда передаётся значение имени переменной и куда осуществляется переход


How to check if the inline button was pressed first, and only then go to the function?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Python Newbie, 2021-10-30
@Levman5

@bot.callback_query_handler(func=lambda call: True)
def answer(call):  # sourcery no-metrics
    
    
    
    if call.data == 'твоя callback_data':
        bot.register_next_step_handler(myVariable, endProgrammFUNC)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question