diff --git a/public/scripts/extensions/quick-reply/api/QuickReplyApi.js b/public/scripts/extensions/quick-reply/api/QuickReplyApi.js
index 938f0dbe1..2e21507c4 100644
--- a/public/scripts/extensions/quick-reply/api/QuickReplyApi.js
+++ b/public/scripts/extensions/quick-reply/api/QuickReplyApi.js
@@ -393,4 +393,44 @@ export class QuickReplyApi {
await set.delete();
this.settingsUi.rerender();
}
+
+
+ /**
+ * Gets a list of all quick reply sets.
+ *
+ * @returns array with the names of all quick reply sets
+ */
+ listSets() {
+ return QuickReplySet.list.map(it=>it.name);
+ }
+ /**
+ * Gets a list of all globally active quick reply sets.
+ *
+ * @returns array with the names of all quick reply sets
+ */
+ listGlobalSets() {
+ return this.settings.config.setList.map(it=>it.set.name);
+ }
+ /**
+ * Gets a list of all quick reply sets activated by the current chat.
+ *
+ * @returns array with the names of all quick reply sets
+ */
+ listChatSets() {
+ return this.settings.chatConfig?.setList?.flatMap(it=>it.set.name) ?? [];
+ }
+
+ /**
+ * Gets a list of all quick replies in the quick reply set.
+ *
+ * @param {String} setName name of the existing quick reply set
+ * @returns array with the labels of this set's quick replies
+ */
+ listQuickReplies(setName) {
+ const set = this.getSetByName(setName);
+ if (!set) {
+ throw new Error(`No quick reply set with name "${name}" found.`);
+ }
+ return set.qrList.map(it=>it.label);
+ }
}
diff --git a/public/scripts/extensions/quick-reply/src/SlashCommandHandler.js b/public/scripts/extensions/quick-reply/src/SlashCommandHandler.js
index 78a09d6f1..5a7ac617e 100644
--- a/public/scripts/extensions/quick-reply/src/SlashCommandHandler.js
+++ b/public/scripts/extensions/quick-reply/src/SlashCommandHandler.js
@@ -24,6 +24,8 @@ export class SlashCommandHandler {
registerSlashCommand('qr-chat-set', (args, value)=>this.toggleChatSet(value, args), [], '[visible=true] (number) – toggle chat QR set', true, true);
registerSlashCommand('qr-chat-set-on', (args, value)=>this.addChatSet(value, args), [], '[visible=true] (number) – activate chat QR set', true, true);
registerSlashCommand('qr-chat-set-off', (_, value)=>this.removeChatSet(value), [], '(number) – deactivate chat QR set', true, true);
+ registerSlashCommand('qr-set-list', (_, value)=>this.listSets(value ?? 'all'), [], '(all|global|chat) – gets a list of the names of all quick reply sets', true, true);
+ registerSlashCommand('qr-list', (_, value)=>this.listQuickReplies(value), [], '(set name) – gets a list of the names of all quick replies in this quick reply set', true, true);
const qrArgs = `
label - string - text on the button, e.g., label=MyButton
@@ -243,4 +245,26 @@ export class SlashCommandHandler {
toastr.error(ex.message);
}
}
+
+ listSets(source) {
+ try {
+ switch (source) {
+ case 'global':
+ return this.api.listGlobalSets();
+ case 'chat':
+ return this.api.listChatSets();
+ default:
+ return this.api.listSets();
+ }
+ } catch (ex) {
+ toastr.error(ex.message);
+ }
+ }
+ listQuickReplies(name) {
+ try {
+ return this.api.listQuickReplies(name);
+ } catch (ex) {
+ toastr.error(ex.message);
+ }
+ }
}