Fix evaluation order of named args

This commit is contained in:
Cohee 2023-11-25 18:18:57 +02:00
parent d862005c1c
commit b8d7b0922d
1 changed files with 5 additions and 3 deletions

View File

@ -1206,13 +1206,15 @@ async function executeSlashCommands(text, unescape = false) {
let unnamedArg = result.value || pipeResult;
if (typeof result.args === 'object') {
for (const [key, value] of Object.entries(result.args)) {
for (let [key, value] of Object.entries(result.args)) {
if (typeof value === 'string') {
value = substituteParams(value.trim());
if (/{{pipe}}/i.test(value)) {
result.args[key] = value.replace(/{{pipe}}/i, pipeResult || '');
value = value.replace(/{{pipe}}/i, pipeResult || '');
}
result.args[key] = substituteParams(value.trim());
result.args[key] = value;
}
}
}