yagop / node-telegram-bot-api

Telegram Bot API for NodeJS
MIT License
8.45k stars 1.53k forks source link

connect ETIMEDOUT #880

Closed aqilhex closed 3 years ago

aqilhex commented 3 years ago

I get this error connect ETIMEDOUT 149.154.167.220:443 each time my ip changed and bot stop working! It's pooling related.

This is my code process.env.NTBA_FIX_319 = 1; const TelegramBot = require('node-telegram-bot-api'); const bot = new TelegramBot(token, {polling: true}); bot.on("polling_error", (err) => console.log(err)); bot.on('message', (msg) => { bot.sendMessage(msg.chat.id, 'Alive... '); });

aqilhex commented 3 years ago

Removing polling and adding this line of code bot.setWebHook(${url}/bot${TOKEN}); saved me.