Browse Source

Allow multiple word commands to work again

pull/7/head
Googie2149 9 years ago
parent
commit
c6f871235f
1 changed files with 25 additions and 0 deletions
  1. +25
    -0
      src/Discord.Net.Commands/CommandsPlugin.cs

+ 25
- 0
src/Discord.Net.Commands/CommandsPlugin.cs View File

@@ -124,6 +124,25 @@ namespace Discord.Commands
if (!CommandParser.Parse(msg, out cmd, out args))
return;

while (!_commands.ContainsKey(cmd))
{
if (args.Length != 0)
{
cmd = $"{cmd} {args[0].Value}";
CommandPart[] tempArgs = new CommandPart[args.Length - 1];
if (args.Length - 1 > 0)
{
for (int i = 0; i < args.Length - 1; i++)
{
tempArgs[i] = args[i + 1];
}
}
args = tempArgs;
}
else
break;
}

if (_commands.ContainsKey(cmd))
{
Command comm = _commands[cmd];
@@ -146,6 +165,12 @@ namespace Discord.Commands
newArgs[j] = args[j].Value;
}
else if (comm.MaxArgs == null && comm.MinArgs == null)
{
newArgs = new string[argCount];
for (int j = 0; j < newArgs.Length; j++)
newArgs[j] = args[j].Value;
}
else if (comm.MaxArgs == null && comm.MinArgs != null)
{
newArgs = new string[argCount];
for (int j = 0; j < newArgs.Length; j++)


Loading…
Cancel
Save