throw exception from QRs window-function if no match

This commit is contained in:
LenAnderson 2024-04-02 12:55:59 -04:00
parent 3b545a7ab1
commit 12a5105312
1 changed files with 4 additions and 2 deletions

View File

@ -183,14 +183,16 @@ const init = async () => {
;
if (!qr) {
let [setName, ...qrName] = name.split('.');
name = qrName.join('.');
qrName = qrName.join('.');
let qrs = QuickReplySet.get(setName);
if (qrs) {
qr = qrs.qrList.find(it=>it.label == name);
qr = qrs.qrList.find(it=>it.label == qrName);
}
}
if (qr && qr.onExecute) {
return await qr.execute(args);
} else {
throw new Error(`No Quick Reply found for "${name}".`);
}
};