Node.js 电报机器人-删除键盘-节点

Node.js 电报机器人-删除键盘-节点,node.js,telegram,telegram-bot,Node.js,Telegram,Telegram Bot,我面临一个非常奇怪的问题,可能与缓存有关 就是这样。 我在nodejs中为电报开发了一个机器人 这个机器人过去有一个自定义键盘,不是“内联键盘” 我决定改变这种行为,并实现了嵌入式键盘 当前代码是这样的: var options = { parse_mode: "Markdown", disable_web_page_preview: true, reply_markup: JSON.stringify({ inline_keyboard: [

我面临一个非常奇怪的问题,可能与缓存有关

就是这样。 我在nodejs中为电报开发了一个机器人

这个机器人过去有一个自定义键盘,不是“内联键盘” 我决定改变这种行为,并实现了嵌入式键盘

当前代码是这样的:

  var options = {
    parse_mode: "Markdown",
    disable_web_page_preview: true,
    reply_markup: JSON.stringify({
      inline_keyboard: [
        [{
          text: 'there may be different solutions to do so, my suggestion:

you can use the very first answer of each user to remove keyboard, first use editMessageText to remove keyboard and then send him the appropriate answer.(note that persist chatIDs that you have removed their keyboard, so you will do this for each user just once)

bot.on('callback_query', function onCallbackQuery(callbackQuery) {
    if(!didWeRemoveHisKeyboard(callbackQuery.from.id))
        removeHisKeyboard(callbackQuery)
    //then handle the user response
})

removeHisKeyboard = function(callbackQuery){
    bot.editMessageText(callbackQuery.message.text,
    {message_id:callbackQuery.message.message_id , chat_id:callbackQuery.from.id,
    reply_markup: {
        remove_keyboard: true
    }}).catch((err) => {
        //some error handling
    }).then(function(res){
         if(res)
             addThisChatToHandledList(callbackQuery.from.id)
    })

}
var选项={
解析_模式:“降价”,
禁用网页预览:true,
reply_标记:JSON.stringify({
内置键盘:[
[{

文本:“这样做可能有不同的解决方案,我的建议是:

您可以使用每个用户的第一个答案来删除键盘,首先使用editMessageText删除键盘,然后向他发送相应的答案。(请注意,保留您已删除其键盘的聊天ID,因此您只需为每个用户执行一次此操作)


请注意,您可能需要根据正在使用的节点模块对此代码进行一些修改。

谢谢您的回复。如果有帮助,我将对其进行测试并向上投票!对于我来说,此答案中真正重要的一点是
删除键盘:true
行。如果没有它,键盘将持续显示每条消息。