fix(discord): use correct content_type property for audio attachment detection#32136
Conversation
Greptile SummaryFixed property name mismatch preventing Discord voice message transcription. Changed
Confidence Score: 5/5
Last reviewed commit: 294a3f1 |
294a3f1 to
342bdec
Compare
…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 openclaw#30034 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
342bdec to
edf4ea8
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: edf4ea84ba
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| } | ||
| } | ||
|
|
||
| const mentionText = hasTypedText ? baseText : ""; |
There was a problem hiding this comment.
Preserve embed text for mention matching
Using hasTypedText ? baseText : "" for mentionText drops all mention-pattern matching whenever message.content is empty, even though baseText can legitimately contain user-visible embed text from resolveDiscordMessageText(...). In guilds with mention gating, embed-only messages (common from integrations/webhooks or relays that place text in embeds) will now be treated as unmentioned and be dropped, which is broader than the audio-placeholder fix and changes previously working behavior.
Useful? React with 👍 / 👎.
|
Landed via temp rebase onto main.
Thanks @jnMetaCode! |
Summary
Fixes #30034 — Discord voice messages not transcribed because the audio pipeline is never triggered.
Root cause: The preflight audio transcription code in
message-handler.preflight.tsused camelCasecontentTypeto access the MIME type on Discord attachments, but the Discord API (APIAttachmentfromdiscord-api-types/v10) uses snake_casecontent_type. This causedhasAudioAttachmentto always evaluate tofalse, so voice messages in guild channels were silently dropped when mention detection was required.Fix: Changed all 5 occurrences of
contentTypetocontent_typein the preflight detection code. The rest of the Discord codebase (e.g.,message-utils.ts:241,256,383,397) already uses the correctcontent_typeproperty.Test plan
vitest run src/discord/monitor/message-handler.preflight— 8 tests passoxfmt --checkpasses🤖 Generated with Claude Code