From 038f17c3a438f5cdcc7d7a8e8f96e89a3d942dd1 Mon Sep 17 00:00:00 2001 From: Master Kwoth Date: Sun, 17 Sep 2017 08:33:16 +0200 Subject: [PATCH] Commands which have no command strings should no longer throw an exception --- src/NadekoBot/Common/Attributes/Aliases.cs | 3 --- src/NadekoBot/Services/Impl/BotCredentials.cs | 5 ----- src/NadekoBot/Services/Impl/Localization.cs | 9 +++++++++ 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/NadekoBot/Common/Attributes/Aliases.cs b/src/NadekoBot/Common/Attributes/Aliases.cs index b6ebbf81..e6c95f67 100644 --- a/src/NadekoBot/Common/Attributes/Aliases.cs +++ b/src/NadekoBot/Common/Attributes/Aliases.cs @@ -2,9 +2,6 @@ using System.Runtime.CompilerServices; using Discord.Commands; using NadekoBot.Services.Impl; - -//todo what if it doesn't exist - namespace NadekoBot.Common.Attributes { public class Aliases : AliasAttribute diff --git a/src/NadekoBot/Services/Impl/BotCredentials.cs b/src/NadekoBot/Services/Impl/BotCredentials.cs index 341c947e..0ee0dea9 100644 --- a/src/NadekoBot/Services/Impl/BotCredentials.cs +++ b/src/NadekoBot/Services/Impl/BotCredentials.cs @@ -90,11 +90,6 @@ namespace NadekoBot.Services.Impl ulong.TryParse(data[nameof(ClientId)], out ulong clId); ClientId = clId; - //var scId = data[nameof(SoundCloudClientId)]; - //SoundCloudClientId = scId; - //SoundCloudClientId = string.IsNullOrWhiteSpace(scId) - // ? - // : scId; CarbonKey = data[nameof(CarbonKey)]; var dbSection = data.GetSection("db"); Db = new DBConfig(string.IsNullOrWhiteSpace(dbSection["Type"]) diff --git a/src/NadekoBot/Services/Impl/Localization.cs b/src/NadekoBot/Services/Impl/Localization.cs index b8a977ec..438153a0 100644 --- a/src/NadekoBot/Services/Impl/Localization.cs +++ b/src/NadekoBot/Services/Impl/Localization.cs @@ -131,6 +131,15 @@ namespace NadekoBot.Services.Impl public static CommandData LoadCommand(string key) { _commandData.TryGetValue(key, out var toReturn); + + if (toReturn == null) + return new CommandData + { + Cmd = key, + Desc = key, + Usage = key, + }; + return toReturn; } }