Browse Source

Added support for blank command groups

tags/docs-0.9
RogueException 9 years ago
parent
commit
ed2ab4e41c
1 changed files with 16 additions and 1 deletions
  1. +16
    -1
      src/Discord.Net.Commands/CommandBuilder.cs

+ 16
- 1
src/Discord.Net.Commands/CommandBuilder.cs View File

@@ -96,7 +96,22 @@ namespace Discord.Commands
=> CreateCommand(""); => CreateCommand("");
public CommandBuilder CreateCommand(string cmd) 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; command.MinPerms = _defaultMinPermissions;
_plugin._commands.Add(command); _plugin._commands.Add(command);
return new CommandBuilder(command); return new CommandBuilder(command);


Loading…
Cancel
Save