Example #1
0
        private IWebProxy?GetProxy(TgOptions options)
        {
            if (options.Socks5 == null)
            {
                return(null);
            }

            var socks5 = options.Socks5;

            return(socks5.Username == null || socks5.Password == null
                ? new HttpToSocks5Proxy(socks5.Hostname, socks5.Port)
                : new HttpToSocks5Proxy(socks5.Hostname, socks5.Port, socks5.Username, socks5.Password));
        }
Example #2
0
 public TgMessenger(ITelegramBotClient api, TgOptions options, HttpClient?client = null)
 {
     _api     = api;
     _options = options;
     _client  = client ?? new HttpClient();
 }