Skip flag parsing when handling proxy tags
This commit is contained in:
@@ -48,9 +48,8 @@ namespace PluralKit.Bot
|
||||
public PKSystem System => _senderSystem;
|
||||
|
||||
public string PopArgument() => _parameters.Pop();
|
||||
public string PeekArgument() => _parameters.Peek();
|
||||
public string Remainder() => _parameters.Remainder();
|
||||
public string RemainderOrNull() => Remainder().Trim().Length == 0 ? null : Remainder();
|
||||
public string PeekArgument() => _parameters.Peek();
|
||||
public string RemainderOrNull(bool skipFlags = true) => _parameters.Remainder(skipFlags).Length == 0 ? null : _parameters.Remainder(skipFlags);
|
||||
public bool HasNext() => RemainderOrNull() != null;
|
||||
public string FullCommand => _parameters.FullCommand;
|
||||
|
||||
|
@@ -101,15 +101,18 @@ namespace PluralKit.Bot
|
||||
return _flags;
|
||||
}
|
||||
|
||||
public string Remainder()
|
||||
public string Remainder(bool skipFlags = true)
|
||||
{
|
||||
// Skip all *leading* flags when taking the remainder
|
||||
while (NextWordPosition(_ptr) is {} wp)
|
||||
if (skipFlags)
|
||||
{
|
||||
if (_cmd[wp.startPos] != '-' || wp.wasQuoted) break;
|
||||
_ptr = wp.endPos + wp.advanceAfterWord;
|
||||
// Skip all *leading* flags when taking the remainder
|
||||
while (NextWordPosition(_ptr) is {} wp)
|
||||
{
|
||||
if (_cmd[wp.startPos] != '-' || wp.wasQuoted) break;
|
||||
_ptr = wp.endPos + wp.advanceAfterWord;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// *Then* get the remainder
|
||||
return _cmd.Substring(Math.Min(_ptr, _cmd.Length)).Trim();
|
||||
}
|
||||
|
Reference in New Issue
Block a user