mirror of
https://github.com/Jetsparrow/karmabot.git
synced 2026-01-21 00:56:09 +03:00
Allow not using proxy
This commit is contained in:
parent
98ba039788
commit
6ff22680b9
@ -33,12 +33,17 @@ namespace JetKarmaBot
|
||||
{
|
||||
using (KarmaContext db = Db.GetContext())
|
||||
await db.Database.EnsureCreatedAsync();
|
||||
var httpProxy = new WebProxy($"{Config.Proxy.Url}:{Config.Proxy.Port}")
|
||||
if (Config.Proxy?.Url == null)
|
||||
Client = new TelegramBotClient(Config.ApiKey);
|
||||
else
|
||||
{
|
||||
Credentials = new NetworkCredential(Config.Proxy.Login, Config.Proxy.Password)
|
||||
};
|
||||
var httpProxy = new WebProxy($"{Config.Proxy.Url}:{Config.Proxy.Port}")
|
||||
{
|
||||
Credentials = new NetworkCredential(Config.Proxy.Login, Config.Proxy.Password)
|
||||
};
|
||||
|
||||
Client = new TelegramBotClient(Config.ApiKey, httpProxy);
|
||||
Client = new TelegramBotClient(Config.ApiKey, httpProxy);
|
||||
}
|
||||
Container.AddInstance(Client);
|
||||
|
||||
timeoutWaitTaskToken = new CancellationTokenSource();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user