我正在使用Node.js telegram-bot-api。
点子:
这是我现在正在使用的代码:
bot.sendMessage({
text: 'Please give us your phone number',
reply_markup: JSON.stringify({
keyboard: [
[{
text: 'Share my phone number',
request_contact: true
}]
],
resize_keyboard: true,
one_time_keyboard: true
})
});
问题:
request_contact
标志时,one_time_keyboard
正常工作(在使用后隐藏按钮),但即使在这种情况下它只是隐藏按钮,因此用户可以点击图标带来它回到了屏幕,这一点都不好。如果我在这里做错了,请告诉我。感谢
答案 0 :(得分:12)
找到它。
这是一个解决方案:
bot.sendMessage({
chat_id: message.chat.id,
text: 'Some text...',
reply_markup: JSON.stringify({
hide_keyboard: true
})
});
答案 1 :(得分:1)
hide_keyboard
自API 2.3起已重命名为remove_keyboard
。
bot.sendMessage({
chat_id: message.chat.id,
text: 'Some text...',
reply_markup: JSON.stringify({
remove_keyboard: true
})
});
答案 2 :(得分:0)
您应该使用editMessageReplyMarkup
并在收到客户端用户的点击后,使用空字符串(replyMarkup
)更新该邮件的''
。
更新这适用于内联键盘。