Merge pull request #1499 from LenAnderson/qr-execute-from-any-preset

Allow /run for quick replies from any preset
This commit is contained in:
Cohee 2023-12-09 19:49:03 +02:00 committed by GitHub
commit 2d7811fa46
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 1 deletions

View File

@ -241,7 +241,15 @@ async function executeQuickReplyByName(name) {
throw new Error('Quick Reply is disabled'); 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) { if (!qr) {
throw new Error(`Quick Reply "${name}" not found`); throw new Error(`Quick Reply "${name}" not found`);