V
V
Vi Vola2018-11-29 20:54:10
linux
Vi Vola, 2018-11-29 20:54:10

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

3 answer(s)
O
Oleg A, 2018-11-29
@hakain

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);
...

I installed the tor bundle and ran the bot through it
127.0.0.1:9150

R
Ruslan Fedoseev, 2018-11-29
@martin74ua

telegram bot works through telegram API. What is a regular site https://api.telegram.bot
What is your bot written on?

U
Uno, 2018-11-30
@Noizefan

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 question

Ask a Question

731 491 924 answers to any question