Commands which have no command strings should no longer throw an exception

This commit is contained in:
Master Kwoth 2017-09-17 08:33:16 +02:00
parent bdc6974451
commit 038f17c3a4
3 changed files with 9 additions and 8 deletions

View File

@ -2,9 +2,6 @@
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using Discord.Commands; using Discord.Commands;
using NadekoBot.Services.Impl; using NadekoBot.Services.Impl;
//todo what if it doesn't exist
namespace NadekoBot.Common.Attributes namespace NadekoBot.Common.Attributes
{ {
public class Aliases : AliasAttribute public class Aliases : AliasAttribute

View File

@ -90,11 +90,6 @@ namespace NadekoBot.Services.Impl
ulong.TryParse(data[nameof(ClientId)], out ulong clId); ulong.TryParse(data[nameof(ClientId)], out ulong clId);
ClientId = clId; ClientId = clId;
//var scId = data[nameof(SoundCloudClientId)];
//SoundCloudClientId = scId;
//SoundCloudClientId = string.IsNullOrWhiteSpace(scId)
// ?
// : scId;
CarbonKey = data[nameof(CarbonKey)]; CarbonKey = data[nameof(CarbonKey)];
var dbSection = data.GetSection("db"); var dbSection = data.GetSection("db");
Db = new DBConfig(string.IsNullOrWhiteSpace(dbSection["Type"]) Db = new DBConfig(string.IsNullOrWhiteSpace(dbSection["Type"])

View File

@ -131,6 +131,15 @@ namespace NadekoBot.Services.Impl
public static CommandData LoadCommand(string key) public static CommandData LoadCommand(string key)
{ {
_commandData.TryGetValue(key, out var toReturn); _commandData.TryGetValue(key, out var toReturn);
if (toReturn == null)
return new CommandData
{
Cmd = key,
Desc = key,
Usage = key,
};
return toReturn; return toReturn;
} }
} }