-1

Im triyng to make filter inside inlinekeyboard, in short:

    markup = types.InlineKeyboardMarkup()
    button_4 = types.InlineKeyboardButton('Да, все верно', callback_data = 'yes')
    button_5 = types.InlineKeyboardButton('Нет, нужно изменить', callback_data = 'no')
    markup.add(button_4, button_5)
    bot.send_message(message.chat.id, 'Введеные данные верны?', reply_markup = markup)
@bot.callback_query_handler(func = lambda call: True)
def answer(call):
    if call.data == 'yes': 
        print('GOT IT')

but nothing happend, i don't see "GOT IT" in terminal (btw i used it in same code at the begin and it works...)

CallMeStag
  • 5,467
  • 1
  • 7
  • 22

1 Answers1

0

Try to Print callBack data:

@bot.message_handler(commands=["start"])
    key = types.InlineKeyboardMarkup()
    key.add(types.InlineKeyboardButton('Да, все верно', callback_data='yes'))
    key.add(types.InlineKeyboardButton('Нет, нужно изменить', callback_data='no'))
    bot.send_message(message.chat.id, 'Введеные данные верны?', reply_markup=markup)

@bot.callback_query_handler(func=lambda call: call.data)
def answer(call):
    print(call.data)