简而言之,Im triyng可以在内联键盘内制作过滤器:
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')但是什么都没有发生,我在终端上没有看到“得到它”(顺便说一下,我在开始的时候使用了相同的代码,它可以工作.)
发布于 2022-10-01 11:11:00
尝试打印 callBack数据:
@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)https://stackoverflow.com/questions/73871708
复制相似问题