Polling timeout in Telegram bot. See new code:
const api = require('node-telegram-bot-api');
const t = 'xxx';
const bot = new api(t, {polling:true});
bot.on('message', m => { if(m.text === '/start') bot.sendMessage(m.chat.id, 'Hi'); });
Polling timeout in Telegram bot. See new code:
const api = require('node-telegram-bot-api');
const t = 'xxx';
const bot = new api(t, {polling:true});
bot.on('message', m => { if(m.text === '/start') bot.sendMessage(m.chat.id, 'Hi'); });
I encountered a similar issue with polling timeouts recently and realized it was due to a combination of network reliability and the way node-telegram-bot-api handles long polling requests. In my case, increasing the polling_timeout value in the bot’s constructor made a significant difference. It is also important to ensure that nothing in your network settings is dropping idle connections. Additionally, checking that you are running the latest version of the package can prevent known issues. I recommend testing these adjustments in a controlled environment to pinpoint the cause.