Revamped CommandsPlugin

This uses a dictionary for the commands list, if a command has a max
args set it'll only get that amount, will call the UnkownCommand event,
and now has a built in help command that can be optionally enabled.
CommandChar is now a list, but a single character can still be used.
Externally, not much should have changed, but commands can be hidden
from the help command and a description can be set. There's probably
more that I've forgotten about.
This commit is contained in:
Googie2149
2015-10-28 23:11:15 -04:00
committed by RogueException
parent acc192c689
commit c729eaae8b
5 changed files with 229 additions and 98 deletions

View File

@@ -9,13 +9,15 @@ namespace Discord.Commands
public int? MinArgs { get; internal set; }
public int? MaxArgs { get; internal set; }
public int MinPerms { get; internal set; }
internal readonly string[] Parts;
public bool IsHidden { get; internal set; }
public string Description { get; internal set; }
internal Func<CommandEventArgs, Task> Handler;
internal Command(string text)
{
Text = text;
Parts = text.ToLowerInvariant().Split(' ');
IsHidden = false; // Set false by default to avoid null error
Description = "No description set for this command.";
}
}
}