Fix matching multiple consecutive quoted strings

This commit is contained in:
Ske 2019-10-27 17:09:15 +01:00
parent 7f55fca625
commit b19b2fbb38

View File

@ -38,10 +38,12 @@ namespace PluralKit.Bot.CommandSystem
return _cmd.Substring(start, end - start).Trim();
}
public string Remainder() => _cmd.Substring(_ptr).Trim();
public string Remainder() => _cmd.Substring(Math.Min(_ptr, _cmd.Length)).Trim();
public string FullCommand => _cmd;
// Returns tuple of (startpos, endpos, advanceafter)
// advanceafter is how much to move the pointer afterwards to point it
// at the start of the next word
private ValueTuple<int, int, int>? NextWordPosition()
{
// Is this the end of the string?
@ -65,7 +67,7 @@ namespace PluralKit.Bot.CommandSystem
return (_ptr, _cmd.Length, 0);
}
return (_ptr + 1, endQuotePosition, 1);
return (_ptr + 1, endQuotePosition, 2);
}
}