mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 08:37:41 +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
|
// Preflight audio transcription for mention detection in guilds
|
||||||
// This allows voice notes to be checked for mentions before being dropped
|
// This allows voice notes to be checked for mentions before being dropped
|
||||||
let preflightTranscript: string | undefined;
|
let preflightTranscript: string | undefined;
|
||||||
const hasAudioAttachment = message.attachments?.some((att: { contentType?: string }) =>
|
const hasAudioAttachment = message.attachments?.some((att: { content_type?: string }) =>
|
||||||
att.contentType?.startsWith("audio/"),
|
att.content_type?.startsWith("audio/"),
|
||||||
);
|
);
|
||||||
const needsPreflightTranscription =
|
const needsPreflightTranscription =
|
||||||
!isDirectMessage &&
|
!isDirectMessage &&
|
||||||
@@ -516,18 +516,18 @@ export async function preflightDiscordMessage(
|
|||||||
const { transcribeFirstAudio } = await import("../../media-understanding/audio-preflight.js");
|
const { transcribeFirstAudio } = await import("../../media-understanding/audio-preflight.js");
|
||||||
const audioPaths =
|
const audioPaths =
|
||||||
message.attachments
|
message.attachments
|
||||||
?.filter((att: { contentType?: string; url: string }) =>
|
?.filter((att: { content_type?: string; url: string }) =>
|
||||||
att.contentType?.startsWith("audio/"),
|
att.content_type?.startsWith("audio/"),
|
||||||
)
|
)
|
||||||
.map((att: { url: string }) => att.url) ?? [];
|
.map((att: { url: string }) => att.url) ?? [];
|
||||||
if (audioPaths.length > 0) {
|
if (audioPaths.length > 0) {
|
||||||
const tempCtx = {
|
const tempCtx = {
|
||||||
MediaUrls: audioPaths,
|
MediaUrls: audioPaths,
|
||||||
MediaTypes: message.attachments
|
MediaTypes: message.attachments
|
||||||
?.filter((att: { contentType?: string; url: string }) =>
|
?.filter((att: { content_type?: string; url: string }) =>
|
||||||
att.contentType?.startsWith("audio/"),
|
att.content_type?.startsWith("audio/"),
|
||||||
)
|
)
|
||||||
.map((att: { contentType?: string }) => att.contentType)
|
.map((att: { content_type?: string }) => att.content_type)
|
||||||
.filter(Boolean) as string[],
|
.filter(Boolean) as string[],
|
||||||
};
|
};
|
||||||
preflightTranscript = await transcribeFirstAudio({
|
preflightTranscript = await transcribeFirstAudio({
|
||||||
|
|||||||
Reference in New Issue
Block a user