diff --git a/public/scripts/extensions/quick-reply/index.js b/public/scripts/extensions/quick-reply/index.js
index 955dcff8e..a58ec8f2c 100644
--- a/public/scripts/extensions/quick-reply/index.js
+++ b/public/scripts/extensions/quick-reply/index.js
@@ -842,6 +842,25 @@ async function qrContextClearCallback(args, label) {
applyQuickReplyPreset(selected_preset);
}
+async function qrPresetAddCallback(args, name) {
+ const quickReplyPreset = {
+ name: name,
+ quickReplyEnabled: JSON.parse(args.enabled ?? null) ?? true,
+ quickActionEnabled: JSON.parse(args.nosend ?? null) ?? false,
+ placeBeforeInputEnabled: JSON.parse(args.before ?? null) ?? false,
+ quickReplySlots: [],
+ numberOfSlots: Number(args.slots ?? '0'),
+ AutoInputInject: JSON.parse(args.inject ?? 'false'),
+ };
+
+ const response = await fetch('/savequickreply', {
+ method: 'POST',
+ headers: getRequestHeaders(),
+ body: JSON.stringify(quickReplyPreset),
+ });
+ await updateQuickReplyPresetList();
+}
+
let onMessageSentExecuting = false;
let onMessageReceivedExecuting = false;
let onChatChangedExecuting = false;
@@ -1046,4 +1065,12 @@ jQuery(() => {
registerSlashCommand('qr-contextadd', qrContextAddCallback, [], `(set=string label=string chain=bool [preset name]) – add context menu preset to a QR, example: /qr-contextadd set=MyPreset label=MyButton chain=true MyOtherPreset`, true, true);
registerSlashCommand('qr-contextdel', qrContextDeleteCallback, [], `(set=string label=string [preset name]) – remove context menu preset from a QR, example: /qr-contextdel set=MyPreset label=MyButton MyOtherPreset`, true, true);
registerSlashCommand('qr-contextclear', qrContextClearCallback, [], `(set=string [label]) – remove all context menu presets from a QR, example: /qr-contextclear set=MyPreset MyButton`, true, true);
+ const presetArgs = `
+ enabled - bool - enable or disable the preset
+ nosend - bool - disable send / insert in user input (invalid for slash commands)
+ before - bool - place QR before user input
+ slots - int - number of slots
+ inject - bool - inject user input automatically (if disabled use {{input}})
+ `.trim();
+ registerSlashCommand('qr-presetadd', qrPresetAddCallback, [], `(arguments [label])\n arguments:\n ${presetArgs} – remove all context menu presets from a QR, example: /qr-contextclear set=MyPreset MyButton`, true, true);
});