Trying to make my first telegram bot, in all examples and instructions it looks very simple and easy to repeat. However, my bot doesn’t work at all. Firstly, I am from Russia and telegram api is blocked, so I need to use proxy. Took one from https://www.socks-proxy.net/. Got token from BotFather. Now when I run my script telegraf.js
:
const Telegraf = require('telegraf');
const SocksAgent = require('socks5-https-client/lib/Agent');
const socksAgent = new SocksAgent({
socksHost: '103.206.97.70',
socksPort: 4145,
});
const bot = new Telegraf(MY_TOKEN, {
telegram: {
agent: socksAgent,
}
});
bot.hears('hi', ctx => {
return ctx.reply('Hey!');
});
bot.startPolling();
nothing happens and program finished.
I understand that problem is in my proxy configuration, but can’t understand what exactly wrong.
2
Answers
The problem was in proxy. I used
https-proxy-agent
instead ofsocks5-https-client