diff --git a/src/Discord.Net.Commands/CommandParser.cs b/src/Discord.Net.Commands/CommandParser.cs index 96747ae96..fc44c0a42 100644 --- a/src/Discord.Net.Commands/CommandParser.cs +++ b/src/Discord.Net.Commands/CommandParser.cs @@ -53,6 +53,13 @@ namespace Discord.Commands else c = '\0'; + //If we're processing a remainder parameter, ignore all other logic + if (curParam != null && curParam.IsRemainder && curPos != endPos) + { + argBuilder.Append(c); + continue; + } + //If this character is escaped, skip it if (isEscaping) { @@ -79,13 +86,6 @@ namespace Discord.Commands continue; } - //If we're processing an remainder parameter, ignore all other logic - if (curParam != null && curParam.IsRemainder && curPos != endPos) - { - argBuilder.Append(c); - continue; - } - //If we're not currently processing one, are we starting the next argument yet? if (curPart == ParserPart.None) { @@ -114,6 +114,23 @@ namespace Discord.Commands } } + //If this character is escaped, skip it + if (isEscaping) + { + if (curPos != endPos) + { + argBuilder.Append(c); + isEscaping = false; + continue; + } + } + //Are we escaping the next character? + if (c == '\\' && (curParam == null || !curParam.IsRemainder)) + { + isEscaping = true; + continue; + } + //Has this parameter ended yet? string argString = null; if (curPart == ParserPart.Parameter)