modify [function] processPrompt

This commit is contained in:
Ho-spair 2024-05-15 17:05:30 +08:00
parent 766e93378e
commit 3f5f8a7f16
2 changed files with 16 additions and 8 deletions

View File

@ -497,10 +497,14 @@ function processPrompt(prompt) {
raw = raw.replace(/%src/g, luatr(getPhoto(src).general)); raw = raw.replace(/%src/g, luatr(getPhoto(src).general));
if (raw.match("%dest")) if (raw.match("%dest"))
raw = raw.replace(/%dest/g, luatr(getPhoto(dest).general)); raw = raw.replace(/%dest/g, luatr(getPhoto(dest).general));
if (raw.match("%arg2"))
raw = raw.replace(/%arg2/g, luatr(data[4])); if (data.length > 3) {
if (raw.match("%arg")) for (let i = 4; i < data.length; i++) {
raw = raw.replace(/%arg/g, luatr(data[3])); raw = raw.replace(new RegExp("%arg" + (i - 2), "g"), data[i]);
}
raw = raw.replace(new RegExp("%arg", "g"), data[3]);
}
return raw; return raw;
} }

View File

@ -21,10 +21,14 @@ function processPrompt(prompt) {
raw = raw.replace(/%src/g, luatr(getPhoto(src).general)); raw = raw.replace(/%src/g, luatr(getPhoto(src).general));
if (raw.match("%dest")) if (raw.match("%dest"))
raw = raw.replace(/%dest/g, luatr(getPhoto(dest).general)); raw = raw.replace(/%dest/g, luatr(getPhoto(dest).general));
if (raw.match("%arg2"))
raw = raw.replace(/%arg2/g, luatr(data[4])); if (data.length > 3) {
if (raw.match("%arg")) for (let i = 4; i < data.length; i++) {
raw = raw.replace(/%arg/g, luatr(data[3])); raw = raw.replace(new RegExp("%arg" + (i - 2), "g"), data[i]);
}
raw = raw.replace(new RegExp("%arg", "g"), data[3]);
}
return raw; return raw;
} }