0

嘿伙计们,当我遇到问题时,我正在使用 nodejs telegram bot api 制作一个电报机器人。我想显示一个 html 解析的消息和它下面的内联键盘

bot.onText(/\/help/, async (msg) => {
  help_msg = `<b>This is the link for the advanced help</b>`;
  var adv_help = {
    reply_markup: JSON.stringify({
      inline_keyboard: [
        [
          {
            text: "Advanced Help",
            url: "https://telegra.ph/Advanced-Help-for-Cloud-Torrenter-07-31",
          },
        ],
      ],
    }),
  };
  bot.sendMessage(msg.chat.id, help_msg, { parse_mode: "HTML" }, adv_help);
});

但在这种情况下,内联键盘按钮根本不会出现,只会出现解析的help_msg 图片在这里

但是如果将最后一行更改为

bot.sendMessage(msg.chat.id, help_msg, adv_help ,{ parse_mode: "HTML" });

原始help_msg的未解析help_msg与内联键盘一起出现 图片 here

任何人都可以建议一种将解析的文本和按钮放在一起的方法

4

1 回答 1

2

我终于得到了答案

命令 sintax 是:bot.sendMessage(chatid, message, options)

对象“reply_markup”,停留在选项内

喜欢

const adv_help =  {
reply_markup: {
      inline_keyboard: [
        [
          {
            text: "Advanced Help",
            url: "https://telegra.ph/Advanced-Help-for-Cloud-Torrenter-07-31",
          }
        ],
      ],
    }, 
   parse_mode: 'HTML'
}

bot.sendMessage(msg.chat.id, `<b>This is the link for the advanced help</b>`,  adv_help)
于 2021-03-31T09:35:00.533 回答