Answer the question
In order to leave comments, you need to log in
How to register checking and waiting for the correct telebot input?
Tell me, please, how to register the correctness check and the expectation of the correct input
Source code:
def question3(message):
question2 = message.text
sql.execute(f"""UPDATE users SET answer2 = '{question2}' WHERE user_id = {message.chat.id}""")
...
bot.register_next_step_handler(msg, question4)
question2[0] == '#'
Answer the question
In order to leave comments, you need to log in
def question3(message):
user_id = message.chat.id
question3 = message.text
if question3.startswith('#'):
sql.execute("")
msg = bot.send_message(user_id, 'Отлично! Следующий вопрос...')
bot.register_next_step_handler(msg, question4)
else:
bot.send_message(user_id, 'Ошибка! Введите ещё раз!')
bot.register_next_step_handler(msg, question3)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question