Answer the question
In order to leave comments, you need to log in
Why doesn't Telegram Bot work even with Proxy?
The first day I study the development of bots and immediately ran into a problem. At first, the bot did not work at all and, as I understood it, the problem was the lack of a proxy. Added them - now the error is different
const TelegramBot = require('node-telegram-bot-api')
const TOKEN = '...................................................................'
const bot = new TelegramBot(TOKEN, {
polling: true,
request: {
proxy: 'https://11.22.33.44:1010/'
}
})
bot.on('message', (msg) => {
console.log(msg)
bot.sendMessage(msg.chat.id, 'Здравствуйте, старина, ' + msg.from.first_name)
})
Answer the question
In order to leave comments, you need to log in
Https-proxy-agent use
const bot = new Telegraf(Token, {
telegram: {
agent: new HttpsProxyAgent({
host: 'host',
port: 'port',
auth: 'username:password' // Если прокси приватный, если нет, то удаляйте строчку
})
}
})
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question