Answer the question
In order to leave comments, you need to log in
Why telegram bot refuses to work?
Good day, the problem is that I am writing a code for a telegram bot, then I run it in the console, everything is going well, only the bot does not react to my messages in any way. Below is the code, I use node-telegram-bot-api, I have already written bots before, everything was ok, now for some reason it does not work. I tried other npm packages like telegram-bot-api and telebot, but the effect is the same. Displayed any text in the console according to my message - similarly. I sinned on the RKN, but the free vpn did not solve the problem, I bought a monthly subscription to tunnelbear, it did not give any results, still nothing works. With all this, no errors appear in the console, the token was rechecked, everything is fine. I don’t know what to do with it anymore, the deadline is already on Sunday.
const TelegramBot = require('node-telegram-bot-api');
const token = 'MY_TOKEN';
const bot = new TelegramBot(token, {
polling: true
});
bot.on("message", (msg) => {
let chatId = msg.chat.id;
let resp = "Response";
bot.sendMessage(chatId, resp);
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question