From b4359c84f799178f10acfd8dce6f5977f48031e6 Mon Sep 17 00:00:00 2001 From: nyanjou Date: Tue, 3 Feb 2026 14:35:30 +0100 Subject: [PATCH] feat(discord): add silent support for voice messages - Add silent flag to sendDiscordVoiceMessage - Combines VOICE_MESSAGE (8192) + SUPPRESS_NOTIFICATIONS (4096) flags - Pass silent through VoiceMessageOpts and action handlers --- src/agents/tools/discord-actions-messaging.ts | 1 + src/discord/voice-message.ts | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/agents/tools/discord-actions-messaging.ts b/src/agents/tools/discord-actions-messaging.ts index cf50961e9..94b40731c 100644 --- a/src/agents/tools/discord-actions-messaging.ts +++ b/src/agents/tools/discord-actions-messaging.ts @@ -258,6 +258,7 @@ export async function handleDiscordMessagingAction( const result = await sendVoiceMessageDiscord(to, mediaUrl, { ...(accountId ? { accountId } : {}), replyTo, + silent, }); return jsonResult({ ok: true, result, voiceMessage: true }); } diff --git a/src/discord/voice-message.ts b/src/discord/voice-message.ts index fb28a9d1a..2b90bec69 100644 --- a/src/discord/voice-message.ts +++ b/src/discord/voice-message.ts @@ -22,6 +22,7 @@ import type { RetryRunner } from "../infra/retry-policy.js"; const execFileAsync = promisify(execFile); const DISCORD_VOICE_MESSAGE_FLAG = 8192; +const SUPPRESS_NOTIFICATIONS_FLAG = 4096; const WAVEFORM_SAMPLES = 256; export type VoiceMessageMetadata = { @@ -225,6 +226,7 @@ export async function sendDiscordVoiceMessage( replyTo: string | undefined, request: RetryRunner, token: string, + silent?: boolean, ): Promise<{ id: string; channel_id: string }> { const filename = "voice-message.ogg"; const fileSize = audioBuffer.byteLength; @@ -278,6 +280,9 @@ export async function sendDiscordVoiceMessage( } // Step 3: Send the message with voice message flag and metadata + const flags = silent + ? DISCORD_VOICE_MESSAGE_FLAG | SUPPRESS_NOTIFICATIONS_FLAG + : DISCORD_VOICE_MESSAGE_FLAG; const messagePayload: { flags: number; attachments: Array<{ @@ -289,7 +294,7 @@ export async function sendDiscordVoiceMessage( }>; message_reference?: { message_id: string; fail_if_not_exists: boolean }; } = { - flags: DISCORD_VOICE_MESSAGE_FLAG, + flags, attachments: [ { id: "0",