Added support for blank command groups

This commit is contained in:
RogueException
2015-10-12 23:09:39 -03:00
parent 54fe30a59a
commit ed2ab4e41c

View File

@@ -96,7 +96,22 @@ namespace Discord.Commands
=> CreateCommand("");
public CommandBuilder CreateCommand(string cmd)
{
var command = new Command(cmd != "" ? _prefix + ' ' + cmd : _prefix);
string text;
if (cmd != "")
{
if (_prefix != "")
text = _prefix + ' ' + cmd;
else
text = cmd;
}
else
{
if (_prefix != "")
text = _prefix;
else
throw new ArgumentOutOfRangeException(nameof(cmd));
}
var command = new Command(text);
command.MinPerms = _defaultMinPermissions;
_plugin._commands.Add(command);
return new CommandBuilder(command);