Skip to content

Commit

Permalink
proxy password and user name
Browse files Browse the repository at this point in the history
  • Loading branch information
tuxinal committed Nov 2, 2020
1 parent e00058e commit 16f05d0
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
5 changes: 4 additions & 1 deletion bot/bot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,12 @@ public class Bot
public static DiscordClient client;
static CommandsNextExtension commands;
static private WebProxy _proxy;
public Bot(string token, string prefix, string proxy)
static private ICredentials credentials;
public Bot(string token, string prefix, string proxy,string proxyUserName,string proxyPassword)
{
credentials = new NetworkCredential(proxyUserName,proxyPassword);
_proxy = new WebProxy(proxy);
_proxy.Credentials = credentials;
MainAsync(token).ConfigureAwait(false).GetAwaiter().GetResult();
commands = client.UseCommandsNext(new CommandsNextConfiguration
{
Expand Down
4 changes: 3 additions & 1 deletion config.impostorCord.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@
"token": "<TOKEN>",
"prefix": ";",
"botProxyEnabled": false,
"botProxyAddress": ""
"botProxyAddress": "",
"botProxyUsername": "",
"botProxyPassword": ""
}
9 changes: 8 additions & 1 deletion main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public ImpostorCord(ILogger<ImpostorCord> logger, IEventManager eventManager)
{
proxyAddress = config.BotProxyAddress;
}
_bot = new Bot(config.Token, config.Prefix, proxyAddress);
_bot = new Bot(config.Token, config.Prefix, proxyAddress, config.BotProxyUsername, config.BotProxyPassword);
eventManager.RegisterListener(new GameEventListener(logger, _bot));
}

Expand All @@ -50,5 +50,12 @@ public class Config

[JsonPropertyName("botProxyAddress")]
public string BotProxyAddress { get; set; }

[JsonPropertyName("botProxyUsername")]
public string BotProxyUsername { get; set; }

[JsonPropertyName("botProxyPassword")]
public string BotProxyPassword { get; set; }

}
}

0 comments on commit 16f05d0

Please sign in to comment.