[英]Cannot use Inline keyboard and parse mode together in node js telegram bot?
Hey Guys I was making an telegram bot using nodejs telegram bot api when I cam across a problem.嘿伙计们,当我遇到问题时,我正在使用 nodejs 电报机器人 api 制作电报机器人。 I wanted to dispaly a html parsed message and an inline keyboard below it
我想显示一个 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);
});
But in this case the inline key board button wont appear at all only the parsed help_msg appears Picture Here但在这种情况下,内联键盘按钮根本不会出现,只会出现解析的help_msg图片在这里
But if change the last line to但是如果将最后一行更改为
bot.sendMessage(msg.chat.id, help_msg, adv_help ,{ parse_mode: "HTML" });
The unparsed help_msg that is the raw help_msg with appears with the inline keyboard Picture here原始help_msg的未解析help_msg与内联键盘一起出现图片 here
can anyone suggest a method to get both the parsed text and button together任何人都可以建议一种将解析的文本和按钮放在一起的方法
I finaly got the answer我终于得到了答案
the command sintax is: bot.sendMessage(chatid, message, options)命令 sintax 是:bot.sendMessage(chatid, message, options)
object "reply_markup", stays within the options object “reply_markup”,保留在选项内
like喜欢
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)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.