I'm building a node Telegram bot using node-telegram-bot-api
which is amazing so far.
However, I want to listen to messages constantly sent to my bot, so I'm using:
bot.on('message', (msg) => {
const Hi = "hi";
if (msg.text.toString().toLowerCase().indexOf(Hi) === 0) {
bot.sendMessage(msg.chat.id,"Hello dear user");
}
});
This runs but then gets to the end of the scripts and closes the node app.
Is there a way of keeping it alive without polling?