Answer the question
In order to leave comments, you need to log in
How to send traffic from a telegram bot through a proxy?
We launched a telegram bot on a remote virtual server, but it does not work due to the fact that its ip is blocked. How can I run telegram bot traffic through a proxy? In this case, other applications should work directly.
Answer the question
In order to leave comments, you need to log in
If you take this library https://github.com/rubenlagus/TelegramBots it's very simple. Everything is described in the wiki of the project
....
// Set up Http proxy
DefaultBotOptions botOptions = ApiContext.getInstance(DefaultBotOptions.class);
botOptions.setProxyHost(PROXY_HOST);
botOptions.setProxyPort(PROXY_PORT);
// Select proxy type: [HTTP|SOCKS4|SOCKS5] (default: NO_PROXY)
botOptions.setProxyType(DefaultBotOptions.ProxyType.SOCKS5);
// Register your newly created AbilityBot
MyBot bot = new MyBot(BOT_TOKEN, BOT_NAME, botOptions);
botsApi.registerBot(bot);
...
127.0.0.1:9150
telegram bot works through telegram API. What is a regular site https://api.telegram.bot
What is your bot written on?
Am I the only one who doesn't understand what people are saying in the comments?
Messages from users are sent by API servers via ssl to a webhooked url. Well, what should be a tenacious proxy or what rich owner of this "cart" should be, so as not to simply rent a server with a different IP?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question