Make Telegram.UseProxy logical

This commit is contained in:
Basique Evangelist 2019-08-12 14:37:49 +00:00
parent a8485edcf9
commit 63393bb8f5

View File

@ -31,15 +31,15 @@ namespace JetHerald
public async Task Init()
{
if (Config.UseProxy)
{
Client = new TelegramBotClient(Config.ApiKey);
}
else
{
var httpProxy = new WebProxy(Config.ProxyUrl)
{ Credentials = new NetworkCredential(Config.ProxyLogin, Config.ProxyPassword) };
Client = new TelegramBotClient(Config.ApiKey, httpProxy);
}
else
{
Client = new TelegramBotClient(Config.ApiKey);
}
Me = await Client.GetMeAsync();
Commands = new ChatCommandRouter(Me.Username, Log);