Bot won't crash right away when token is incorrect. It will show an error message and exit on key press.

This commit is contained in:
Master Kwoth 2017-06-05 07:42:00 +02:00
parent 53b45c1fdb
commit 3433a75125

View File

@ -61,7 +61,11 @@ namespace NadekoBot.Services.Impl
Token = data[nameof(Token)]; Token = data[nameof(Token)];
if (string.IsNullOrWhiteSpace(Token)) if (string.IsNullOrWhiteSpace(Token))
throw new ArgumentNullException(nameof(Token), "Token is missing from credentials.json or Environment varibles."); {
_log.Error("Token is missing from credentials.json or Environment varibles. Add it and restart the program.");
Console.ReadKey();
Environment.Exit(3);
}
OwnerIds = data.GetSection("OwnerIds").GetChildren().Select(c => ulong.Parse(c.Value)).ToImmutableArray(); OwnerIds = data.GetSection("OwnerIds").GetChildren().Select(c => ulong.Parse(c.Value)).ToImmutableArray();
LoLApiKey = data[nameof(LoLApiKey)]; LoLApiKey = data[nameof(LoLApiKey)];
GoogleApiKey = data[nameof(GoogleApiKey)]; GoogleApiKey = data[nameof(GoogleApiKey)];