Merge pull request #1750 from LenAnderson/slash-escapes

unescape args before calling callback
This commit is contained in:
Cohee 2024-02-02 21:00:24 +02:00 committed by GitHub
commit d0b8c4e2d8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 1 deletions

View File

@ -1565,6 +1565,19 @@ async function executeSlashCommands(text, unescape = false) {
unnamedArg = unnamedArg.replace(/{{pipe}}/i, pipeResult ?? '');
}
unnamedArg = unnamedArg
?.replace(/\\\|/g, '|')
?.replace(/\\\{/g, '{')
?.replace(/\\\}/g, '}')
;
for (const [key, value] of Object.entries(result.args)) {
result.args[key] = value
.replace(/\\\|/g, '|')
.replace(/\\\{/g, '{')
.replace(/\\\}/g, '}')
;
}
pipeResult = await result.command.callback(result.args, unnamedArg);
if (result.command.interruptsGeneration) {

View File

@ -492,7 +492,7 @@ async function executeSubCommands(command) {
command = command.slice(0, -1);
}
const unescape = true;
const unescape = false;
const result = await executeSlashCommands(command, unescape);
if (!result || typeof result !== 'object') {