Add Parent property to ModuleInfo

This commit is contained in:
james7132
2016-11-27 01:28:11 -08:00
parent aceac76d1d
commit 0771fcce63
2 changed files with 15 additions and 8 deletions

View File

@@ -14,8 +14,7 @@ namespace Discord.Commands.Builders
public CommandService Service { get; }
public ModuleBuilder Parent { get; }
public string Name { get; set; }
public string Summary { get; set; }
public string Remarks { get; set; }
public string Summary { get; set; } public string Remarks { get; set; }
public IReadOnlyList<CommandBuilder> Commands => _commands;
public IReadOnlyList<ModuleBuilder> Modules => _submodules;
@@ -97,13 +96,17 @@ namespace Discord.Commands.Builders
return this;
}
public ModuleInfo Build(CommandService service)
private ModuleInfo BuildImpl(CommandService service, ModuleInfo parent = null)
{
//Default name to first alias
if (Name == null)
Name = _aliases[0];
return new ModuleInfo(this, service);
return new ModuleInfo(this, service, parent);
}
public ModuleInfo Build(CommandService service) => BuildImpl(service);
internal ModuleInfo Build(CommandService service, ModuleInfo parent) => BuildImpl(service, parent);
}
}