python 电报机器人 api 内联键盘按钮未获取 callback_data
python telegram bot api inlinekeyboardbutton not getting callback_data
python telegram bot api inlinekeyboardbutton 没有得到 callback_data,
我正在使用远程机器人库,
这就是我创建按钮的方式
markup = types.ReplyKeyboardMarkup(row_width=2)
b1 = types.InlineKeyboardButton("button 1", callback_data='1')
b2 = types.InlineKeyboardButton('Button 2', callback_data='2')
markup.add(b1, b2)
bot.send_message(cid, 'message', reply_markup=markup)
按钮出现了,我可以按下它们,但是 returns 我的 callback_query_handler
@bot.callback_query_handler(func=lambda call: True)
def callback_button(call):
try:
if call.message:
cid = message.chat.id
if call.data == '1':
pass
elif call.data == '2':
pass
except:
pass
事实证明,InlineKeyboardButton
个对象不会 return 回调为 ReplyKeyboardButton
个对象。
InlineKeyboardButton
作为消息发送,它们将出现在 message_handler
中
python telegram bot api inlinekeyboardbutton 没有得到 callback_data,
我正在使用远程机器人库,
这就是我创建按钮的方式
markup = types.ReplyKeyboardMarkup(row_width=2)
b1 = types.InlineKeyboardButton("button 1", callback_data='1')
b2 = types.InlineKeyboardButton('Button 2', callback_data='2')
markup.add(b1, b2)
bot.send_message(cid, 'message', reply_markup=markup)
按钮出现了,我可以按下它们,但是 returns 我的 callback_query_handler
@bot.callback_query_handler(func=lambda call: True)
def callback_button(call):
try:
if call.message:
cid = message.chat.id
if call.data == '1':
pass
elif call.data == '2':
pass
except:
pass
事实证明,InlineKeyboardButton
个对象不会 return 回调为 ReplyKeyboardButton
个对象。
InlineKeyboardButton
作为消息发送,它们将出现在 message_handler