feat: Send Quick Reply Before Message Generation (#4407)

* feat: Send Quick Reply Before Message Generation

* fix: Use correct event and check for dry runs on before-generation

* Replace icon

* Skip for events in groups outside of group wrapper

* Compatibility with API and slash commands

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
This commit is contained in:
MAX-TAB
2025-08-21 20:39:16 +03:00
committed by GitHub
co-authored by Cohee
parent 40f4792b32
commit 63dcda8609
6 changed files with 42 additions and 0 deletions
@@ -36,6 +36,7 @@ export class SlashCommandHandler {
if (qr.executeOnChatChange) icons += '💬';
if (qr.executeOnNewChat) icons += '🆕';
if (qr.executeOnGroupMemberDraft) icons += enumIcons.group;
if (qr.executeBeforeGeneration) icons += '✈️';
return icons;
}
@@ -267,6 +268,7 @@ export class SlashCommandHandler {
new SlashCommandNamedArgument('load', 'auto execute on chat load, e.g., load=true', [ARGUMENT_TYPE.BOOLEAN], false, false, 'false'),
new SlashCommandNamedArgument('new', 'auto execute on new chat, e.g., new=true', [ARGUMENT_TYPE.BOOLEAN], false, false, 'false'),
new SlashCommandNamedArgument('group', 'auto execute on group member selection, e.g., group=true', [ARGUMENT_TYPE.BOOLEAN], false, false, 'false'),
new SlashCommandNamedArgument('generation', 'auto execute before message generation, e.g., generation=true', [ARGUMENT_TYPE.BOOLEAN], false, false, 'false'),
new SlashCommandNamedArgument('title', 'title / tooltip to be shown on button, e.g., title="My Fancy Button"', [ARGUMENT_TYPE.STRING], false),
];
const qrUpdateArgs = [
@@ -874,6 +876,7 @@ export class SlashCommandHandler {
executeOnChatChange: isTrueBoolean(args.load),
executeOnNewChat: isTrueBoolean(args.new),
executeOnGroupMemberDraft: isTrueBoolean(args.group),
executeBeforeGeneration: isTrueBoolean(args.generation),
automationId: args.automationId ?? '',
},
);
@@ -910,6 +913,7 @@ export class SlashCommandHandler {
executeOnChatChange: args.load === undefined ? undefined : isTrueBoolean(args.load),
executeOnGroupMemberDraft: args.group === undefined ? undefined : isTrueBoolean(args.group),
executeOnNewChat: args.new === undefined ? undefined : isTrueBoolean(args.new),
executeBeforeGeneration: args.generation === undefined ? undefined : isTrueBoolean(args.generation),
automationId: args.automationId ?? '',
},
);