mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
use parseQuotedValue and parseValue to determine name for "/:"
QR labels and set names can include spaces
This commit is contained in:
@ -272,7 +272,8 @@ export class SlashCommandParser {
|
|||||||
cmd.command = this.commands[cmd.name];
|
cmd.command = this.commands[cmd.name];
|
||||||
this.commandIndex.push(cmd);
|
this.commandIndex.push(cmd);
|
||||||
this.take(2); //discard "/:"
|
this.take(2); //discard "/:"
|
||||||
while (!/\s/.test(this.char) && !this.testRunShorthandEnd()) cmd.value += this.take(); // take chars until whitespace or end
|
if (this.testQuotedValue()) cmd.value = this.parseQuotedValue();
|
||||||
|
else cmd.value = this.parseValue();
|
||||||
this.discardWhitespace();
|
this.discardWhitespace();
|
||||||
while (this.testNamedArgument()) {
|
while (this.testNamedArgument()) {
|
||||||
const arg = this.parseNamedArgument();
|
const arg = this.parseNamedArgument();
|
||||||
@ -281,7 +282,7 @@ export class SlashCommandParser {
|
|||||||
}
|
}
|
||||||
this.discardWhitespace();
|
this.discardWhitespace();
|
||||||
// /run shorthand does not take unnamed arguments (the command name practically *is* the unnamed argument)
|
// /run shorthand does not take unnamed arguments (the command name practically *is* the unnamed argument)
|
||||||
if (this.testCommandEnd()) {
|
if (this.testRunShorthandEnd()) {
|
||||||
cmd.end = this.index;
|
cmd.end = this.index;
|
||||||
if (!cmd.command?.purgeFromMessage) this.keptText += this.text.slice(cmd.start, cmd.end);
|
if (!cmd.command?.purgeFromMessage) this.keptText += this.text.slice(cmd.start, cmd.end);
|
||||||
return cmd;
|
return cmd;
|
||||||
|
Reference in New Issue
Block a user