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())
|
using (KarmaContext db = Db.GetContext())
|
||||||
await db.Database.EnsureCreatedAsync();
|
await db.Database.EnsureCreatedAsync();
|
||||||
|
if (Config.Proxy?.Url == null)
|
||||||
|
Client = new TelegramBotClient(Config.ApiKey);
|
||||||
|
else
|
||||||
|
{
|
||||||
var httpProxy = new WebProxy($"{Config.Proxy.Url}:{Config.Proxy.Port}")
|
var httpProxy = new WebProxy($"{Config.Proxy.Url}:{Config.Proxy.Port}")
|
||||||
{
|
{
|
||||||
Credentials = new NetworkCredential(Config.Proxy.Login, Config.Proxy.Password)
|
Credentials = new NetworkCredential(Config.Proxy.Login, Config.Proxy.Password)
|
||||||
};
|
};
|
||||||
|
|
||||||
Client = new TelegramBotClient(Config.ApiKey, httpProxy);
|
Client = new TelegramBotClient(Config.ApiKey, httpProxy);
|
||||||
|
}
|
||||||
Container.AddInstance(Client);
|
Container.AddInstance(Client);
|
||||||
|
|
||||||
timeoutWaitTaskToken = new CancellationTokenSource();
|
timeoutWaitTaskToken = new CancellationTokenSource();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user