Answer the question
In order to leave comments, you need to log in
How to run a Telegram bot on Node.js with Proxy?
process.env["NTBA_FIX_319"] = 1
const TelegramBot = require('node-telegram-bot-api')
const TOKEN = 'my_token' // changed
const bot = new TelegramBot(TOKEN, {
polling: true,
request: {
proxy: 'http://46.105.57.149:43878/'
}
});
bot.on('message', (msg) => {
console.log(msg)
bot.sendMessage(msg.chat.id, "Privet")
})
error: [polling_error] {"code":"EFATAL","message":"EFATAL: Error: tunneling socket could not be established, cause=connect ETIMEDOUT 46.105.57.149:43878"}
Answer the question
In order to leave comments, you need to log in
Use a proxy with connect support,
or better, connect using socks5 proxy
https://github.com/yagop/node-telegram-bot-api/iss...
Before starting the bot, write this in the console itself:
rem // npm config set https-proxy http://user:[email protected]:8080
npm config set https-proxy http://46.105.57.149:43878/
npm config set https-proxy https://46.105.57.149:43878/
npm config rm proxy
npm config rm https-proxy
npm config --global rm proxy
npm config --global rm https-proxy
npm config delete proxy
npm config delete https-proxy
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question