From 3433a751258c81f17ee68d9dded5472c5b354a59 Mon Sep 17 00:00:00 2001 From: Master Kwoth Date: Mon, 5 Jun 2017 07:42:00 +0200 Subject: [PATCH] Bot won't crash right away when token is incorrect. It will show an error message and exit on key press. --- src/NadekoBot/Services/Impl/BotCredentials.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/NadekoBot/Services/Impl/BotCredentials.cs b/src/NadekoBot/Services/Impl/BotCredentials.cs index 82338207..49eb56ec 100644 --- a/src/NadekoBot/Services/Impl/BotCredentials.cs +++ b/src/NadekoBot/Services/Impl/BotCredentials.cs @@ -61,7 +61,11 @@ namespace NadekoBot.Services.Impl Token = data[nameof(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(); LoLApiKey = data[nameof(LoLApiKey)]; GoogleApiKey = data[nameof(GoogleApiKey)];