Finish implementation of command builders

This commit is contained in:
FiniteReality
2016-11-16 20:40:28 +00:00
parent ab95ced41d
commit 6d46347ebc
8 changed files with 255 additions and 53 deletions

View File

@@ -22,7 +22,7 @@ namespace Discord.Commands.Builders
public string Name { get; set; }
public string Summary { get; set; }
public string Remarks { get; set; }
public Func<CommandContext, object[], Task> Callback { get; set; }
public Func<CommandContext, object[], IDependencyMap, Task> Callback { get; set; }
public ModuleBuilder Module { get; }
public List<PreconditionAttribute> Preconditions => preconditions;
@@ -47,7 +47,7 @@ namespace Discord.Commands.Builders
return this;
}
public CommandBuilder SetCallback(Func<CommandContext, object[], Task> callback)
public CommandBuilder SetCallback(Func<CommandContext, object[], IDependencyMap, Task> callback)
{
Callback = callback;
return this;

View File

@@ -12,16 +12,16 @@ namespace Discord.Commands.Builders
private List<string> aliases;
public ModuleBuilder()
: this(null)
{ }
internal ModuleBuilder(ModuleBuilder parent)
{
commands = new List<CommandBuilder>();
submodules = new List<ModuleBuilder>();
preconditions = new List<PreconditionAttribute>();
aliases = new List<string>();
}
internal ModuleBuilder(ModuleBuilder parent)
: this()
{
ParentModule = parent;
}

View File

@@ -39,6 +39,7 @@ namespace Discord.Commands.Builders
public ParameterBuilder SetDefault<T>(T defaultValue)
{
Optional = true;
DefaultValue = defaultValue;
ParameterType = typeof(T);