Added command groups, fixed several bugs

This commit is contained in:
RogueException
2016-06-27 06:56:24 -03:00
parent 6300a24eb5
commit 7bb890cbfe
9 changed files with 72 additions and 42 deletions

View File

@@ -19,13 +19,13 @@ namespace Discord.Commands
public Module Module { get; }
public IReadOnlyList<CommandParameter> Parameters { get; }
internal Command(Module module, object instance, CommandAttribute attribute, MethodInfo methodInfo)
internal Command(Module module, object instance, CommandAttribute attribute, MethodInfo methodInfo, string groupPrefix)
{
Module = module;
_instance = instance;
Name = methodInfo.Name;
Text = attribute.Text;
Text = groupPrefix + attribute.Text;
var description = methodInfo.GetCustomAttribute<DescriptionAttribute>();
if (description != null)
@@ -40,7 +40,7 @@ namespace Discord.Commands
if (!searchResult.IsSuccess)
return ParseResult.FromError(searchResult);
return await CommandParser.ParseArgs(this, msg, searchResult.ArgText, 0).ConfigureAwait(false);
return await CommandParser.ParseArgs(this, msg, searchResult.Text.Substring(Text.Length), 0).ConfigureAwait(false);
}
public async Task<ExecuteResult> Execute(IMessage msg, ParseResult parseResult)
{