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.
24 lines
634 B
C#
24 lines
634 B
C#
using System;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Discord.Commands
|
|
{
|
|
public sealed class Command
|
|
{
|
|
public string Text { get; }
|
|
public int? MinArgs { get; internal set; }
|
|
public int? MaxArgs { get; internal set; }
|
|
public int MinPerms { get; internal set; }
|
|
public bool IsHidden { get; internal set; }
|
|
public string Description { get; internal set; }
|
|
internal Func<CommandEventArgs, Task> Handler;
|
|
|
|
internal Command(string text)
|
|
{
|
|
Text = text;
|
|
IsHidden = false; // Set false by default to avoid null error
|
|
Description = "No description set for this command.";
|
|
}
|
|
}
|
|
}
|