'Telegram Bot how to send HTML file directly? [duplicate]
I created a game using HTML, now I am trying to import it in my js file, and send to user.
This is my code so far
const { Telegraf } = require('telegraf')
const bot = new Telegraf(process.env.BOT_TOKEN);
const test = require('./index.html');
bot.hears('?', ctx => {
// console.log(ctx.from)
let msg = `Spin the wheel`;
ctx.deleteMessage();
bot.telegram.sendMessage(ctx.chat.id, msg, {
reply_markup: {
inline_keyboard: [
[{
text: "SPIN",
callback_data: 'wheeloffortune'
}
],
]
}
})
})
bot.action('wheeloffortune', ctx => {
bot.telegram.sendMessage(ctx.chat.id, test, {parse_mode: 'HTML'});
})
but I am getting this error
<!DOCTYPE html>
^
SyntaxError: Unexpected token '<'
Any advice is appreciated
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
