feat(#709): add configured Discord interaction binding #730

Merged
jason.woltje merged 10 commits from feat/tess-discord into main 2026-07-13 09:02:46 +00:00
Showing only changes of commit 6af68e76de - Show all commits

View File

@@ -688,7 +688,7 @@ export class ChatGateway implements OnGatewayInit, OnGatewayConnection, OnGatewa
@MessageBody() envelope: DiscordIngressEnvelope,
): Promise<void> {
if (!client.data.discordService) return;
const ingress = this.resolveDiscordIngress(client, envelope, 'approve');
const ingress = this.resolveDiscordIngress(client, envelope, 'stop');
const actionParts = ingress?.content.match(/^\/stop\s+([^\s]+)\s+([^\s]+)\s+([^\s]+)$/i);
const serviceUserId = process.env['DISCORD_SERVICE_USER_ID'];
if (!ingress || !actionParts || !serviceUserId || !this.runtimeRegistry) return;
@@ -697,7 +697,7 @@ export class ChatGateway implements OnGatewayInit, OnGatewayConnection, OnGatewa
ingress.guildId,
ingress.channelId,
ingress.userId,
'approve',
'stop',
);
if (!binding) return;
@@ -721,7 +721,7 @@ export class ChatGateway implements OnGatewayInit, OnGatewayConnection, OnGatewa
private resolveDiscordIngress(
client: Socket,
envelope: DiscordIngressEnvelope,
operation: 'send' | 'approve' = 'send',
operation: 'send' | 'approve' | 'stop' = 'send',
): DiscordIngressPayload | null {
const payload = verifyDiscordIngressEnvelope(
envelope,