电报bot api inlineKeyboard不工作
我为我的电报bot使用node_telegram_bot_api 。 我创build了一个内联键盘button:
var bot = new loader.Bot(config.botToken,{polling:true}); var options = { reply_markup: JSON.stringify({ inline_keyboard: [ [{text: 'Some button text 1', callback_data: '1'}], // Clicking will send "1" [{text: 'Some button text 2', callback_data: '2'}], // Clicking will send "2" [{text: 'Some button text 3', callback_data: '3'}] // Clicking will send "3" ] }) }; bot.sendMessage(msg.from.id, "Click a button to display data", options);
我告诉一个callback_query函数来听取点击button:
bot.on('callback_query', function(msg) { var user = msg.from.id; var data = msg.data; bot.sendMessage(msg.from.id, "You clicked button with data '"+ data +"'"); });
点击button后,该function没有实现。 你可以帮我吗?