mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-28 09:33:06 +00:00
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 <noreply@anthropic.com>
This commit is contained in:
committed by
Peter Steinberger
parent
319b7c68a1
commit
b9b47f5002
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user