mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
QR auto-execute on group member draft
This commit is contained in:
@ -73,4 +73,13 @@ export class AutoExecuteHandler {
|
||||
];
|
||||
await this.performAutoExecute(qrList);
|
||||
}
|
||||
|
||||
async handleGroupMemberDraft() {
|
||||
if (!this.checkExecute()) return;
|
||||
const qrList = [
|
||||
...this.settings.config.setList.map(link=>link.set.qrList.filter(qr=>qr.executeOnGroupMemberDraft)).flat(),
|
||||
...(this.settings.chatConfig?.setList?.map(link=>link.set.qrList.filter(qr=>qr.executeOnGroupMemberDraft))?.flat() ?? []),
|
||||
];
|
||||
await this.performAutoExecute(qrList);
|
||||
}
|
||||
}
|
||||
|
@ -30,6 +30,7 @@ export class QuickReply {
|
||||
/**@type {Boolean}*/ executeOnUser = false;
|
||||
/**@type {Boolean}*/ executeOnAi = false;
|
||||
/**@type {Boolean}*/ executeOnChatChange = false;
|
||||
/**@type {Boolean}*/ executeOnGroupMemberDraft = false;
|
||||
|
||||
/**@type {Function}*/ onExecute;
|
||||
/**@type {Function}*/ onDelete;
|
||||
@ -351,7 +352,13 @@ export class QuickReply {
|
||||
this.executeOnChatChange = executeOnChatChange.checked;
|
||||
this.updateContext();
|
||||
});
|
||||
|
||||
/**@type {HTMLInputElement}*/
|
||||
const executeOnGroupMemberDraft = dom.querySelector('#qr--executeOnGroupMemberDraft');
|
||||
executeOnGroupMemberDraft.checked = this.executeOnGroupMemberDraft;
|
||||
executeOnGroupMemberDraft.addEventListener('click', ()=>{
|
||||
this.executeOnGroupMemberDraft = executeOnGroupMemberDraft.checked;
|
||||
this.updateContext();
|
||||
});
|
||||
|
||||
/**@type {HTMLElement}*/
|
||||
const executeErrors = dom.querySelector('#qr--modal-executeErrors');
|
||||
@ -484,6 +491,7 @@ export class QuickReply {
|
||||
executeOnUser: this.executeOnUser,
|
||||
executeOnAi: this.executeOnAi,
|
||||
executeOnChatChange: this.executeOnChatChange,
|
||||
executeOnGroupMemberDraft: this.executeOnGroupMemberDraft,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -36,6 +36,7 @@ export class SlashCommandHandler {
|
||||
user - bool - auto execute on user message, e.g., user=true
|
||||
bot - bool - auto execute on AI message, e.g., bot=true
|
||||
load - bool - auto execute on chat load, e.g., load=true
|
||||
group - bool - auto execute on group member selection, e.g., group=true
|
||||
title - string - title / tooltip to be shown on button, e.g., title="My Fancy Button"
|
||||
`.trim();
|
||||
const qrUpdateArgs = `
|
||||
@ -148,6 +149,7 @@ export class SlashCommandHandler {
|
||||
executeOnUser: isTrueBoolean(args.user),
|
||||
executeOnAi: isTrueBoolean(args.bot),
|
||||
executeOnChatChange: isTrueBoolean(args.load),
|
||||
executeOnGroupMemberDraft: isTrueBoolean(args.group),
|
||||
},
|
||||
);
|
||||
} catch (ex) {
|
||||
@ -168,6 +170,7 @@ export class SlashCommandHandler {
|
||||
executeOnUser: args.user === undefined ? undefined : isTrueBoolean(args.user),
|
||||
executeOnAi: args.bot === undefined ? undefined : isTrueBoolean(args.bot),
|
||||
executeOnChatChange: args.load === undefined ? undefined : isTrueBoolean(args.load),
|
||||
executeOnGroupMemberDraft: args.group === undefined ? undefined : isTrueBoolean(args.group),
|
||||
},
|
||||
);
|
||||
} catch (ex) {
|
||||
|
Reference in New Issue
Block a user