From d00861d9133f0a868ab11602b19f635058fe6d49 Mon Sep 17 00:00:00 2001 From: LenAnderson Date: Sat, 9 Dec 2023 17:20:15 +0000 Subject: [PATCH] allow /run for quick replies from other presets /run otherPresetName.quickReplyLabel --- public/scripts/extensions/quick-reply/index.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/public/scripts/extensions/quick-reply/index.js b/public/scripts/extensions/quick-reply/index.js index 8b659df60..36260bd83 100644 --- a/public/scripts/extensions/quick-reply/index.js +++ b/public/scripts/extensions/quick-reply/index.js @@ -241,7 +241,15 @@ async function executeQuickReplyByName(name) { throw new Error('Quick Reply is disabled'); } - const qr = extension_settings.quickReply.quickReplySlots.find(x => x.label == name); + let qr = extension_settings.quickReply.quickReplySlots.find(x => x.label == name); + + if (!qr && name.includes('.')) { + const [presetName, qrName] = name.split('.'); + const preset = presets.find(x => x.name == presetName); + if (preset) { + qr = preset.quickReplySlots.find(x => x.label == qrName); + } + } if (!qr) { throw new Error(`Quick Reply "${name}" not found`);