From b9b47f50023d9f6384372bad6eee1a181b98c48e Mon Sep 17 00:00:00 2001 From: jiangnan <1394485448@qq.com> Date: Tue, 3 Mar 2026 04:18:55 +0800 Subject: [PATCH] fix(discord): use correct content_type property for audio attachment detection The preflight audio transcription detection used camelCase `contentType` but Discord's APIAttachment type uses snake_case `content_type`. This caused `hasAudioAttachment` to always be false, preventing voice message transcription from triggering in guild channels where mention detection requires audio preflight. Fixes #30034 Co-Authored-By: Claude Opus 4.6 --- src/discord/monitor/message-handler.preflight.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/discord/monitor/message-handler.preflight.ts b/src/discord/monitor/message-handler.preflight.ts index ba4aa688e02..0916d2a15af 100644 --- a/src/discord/monitor/message-handler.preflight.ts +++ b/src/discord/monitor/message-handler.preflight.ts @@ -501,8 +501,8 @@ export async function preflightDiscordMessage( // Preflight audio transcription for mention detection in guilds // This allows voice notes to be checked for mentions before being dropped let preflightTranscript: string | undefined; - const hasAudioAttachment = message.attachments?.some((att: { contentType?: string }) => - att.contentType?.startsWith("audio/"), + const hasAudioAttachment = message.attachments?.some((att: { content_type?: string }) => + att.content_type?.startsWith("audio/"), ); const needsPreflightTranscription = !isDirectMessage && @@ -516,18 +516,18 @@ export async function preflightDiscordMessage( const { transcribeFirstAudio } = await import("../../media-understanding/audio-preflight.js"); const audioPaths = message.attachments - ?.filter((att: { contentType?: string; url: string }) => - att.contentType?.startsWith("audio/"), + ?.filter((att: { content_type?: string; url: string }) => + att.content_type?.startsWith("audio/"), ) .map((att: { url: string }) => att.url) ?? []; if (audioPaths.length > 0) { const tempCtx = { MediaUrls: audioPaths, MediaTypes: message.attachments - ?.filter((att: { contentType?: string; url: string }) => - att.contentType?.startsWith("audio/"), + ?.filter((att: { content_type?: string; url: string }) => + att.content_type?.startsWith("audio/"), ) - .map((att: { contentType?: string }) => att.contentType) + .map((att: { content_type?: string }) => att.content_type) .filter(Boolean) as string[], }; preflightTranscript = await transcribeFirstAudio({