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:
committed by
RogueException
parent
acc192c689
commit
c729eaae8b
@@ -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.";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user