0
votes

I'm trying to get code from user and if it's correct to start sending him options. But the third function (send_welcome) doesn't start. Could you say what I'm missing?

@bot.message_handler(commands=['start'])
def send_text_request(message):
    msg = bot.send_message(message.chat.id, "Write a code")
    bot.register_next_step_handler(msg, function)
def function(message):
    if message.text=='6':
        print('hello')
        bot.register_next_step_handler(message, send_welcome)
def send_welcome(message):
    markup=types.ReplyKeyboardRemove(selective=False)
    markup = types.ReplyKeyboardMarkup(resize_keyboard=True, row_width=2)
    itembtn1 = types.KeyboardButton("option1")
    itembtn2 = types.KeyboardButton("option2")
    markup.add(itembtn1, itembtn2)

    msg = bot.send_message(message.chat.id, "Hello "+message.from_user.first_name+", I will help you! \n Enter the product", reply_markup=markup)