Reputation: 137
Hey Guys I was making an telegram bot using nodejs telegram bot api when I cam across a problem . I wanted to dispaly a html parsed message and an inline keyboard below it
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
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
can anyone suggest a method to get both the parsed text and button together
Upvotes: 1
Views: 3105
Reputation: 137
I finaly got the answer
the command sintax is: bot.sendMessage(chatid, message, options)
object "reply_markup", stays within the options
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)
Upvotes: 3