#23067: feat(telegram): add disableAudioPreflight config for groups and topics
channel: telegram
size: S
## Summary
Add a `disableAudioPreflight` configuration option for Telegram groups and topics.
Currently, OpenClaw automatically transcribes voice notes in groups where a mention is required to detect if the bot was addressed. This can lead to unintended API costs in busy groups. This PR allows bot owners to opt-out of this behavior.
## Changes
- **Configuration**: Added `disableAudioPreflight?: boolean` to `TelegramTopicConfig` and `TelegramGroupConfig` in `src/config/types.telegram.ts`.
- **Logic**: Updated `buildTelegramMessageContext` in `src/telegram/bot-message-context.ts` to skip preflight transcription if `disableAudioPreflight` is set to `true`.
- **Tests**: Added a unit test in `src/telegram/bot-message-context.audio-transcript.test.ts` to verify that transcription is skipped when the flag is enabled.
## Verification
- Ran `pnpm test src/telegram/bot-message-context.audio-transcript.test.ts` - **PASS**
- Verified that `transcribeFirstAudio` is not called when the config is active.
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Added `disableAudioPreflight` configuration option for Telegram groups and topics to allow bot owners to opt-out of automatic voice-note transcription for mention detection, preventing unintended API costs in busy groups.
- Config fields added to `TelegramTopicConfig` and `TelegramGroupConfig` in `src/config/types.telegram.ts:179` and `src/config/types.telegram.ts:200`
- Logic updated in `buildTelegramMessageContext` to skip preflight transcription when flag is enabled using existing `firstDefined` pattern for config resolution
- Test coverage added to verify transcription is skipped when config is active
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge with minimal risk
- Clean implementation that follows existing codebase patterns consistently, includes test coverage, and solves a well-defined problem without introducing new dependencies or side effects
- No files require special attention
<sub>Last reviewed commit: 1156030</sub>
<!-- greptile_other_comments_section -->
<sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#17120: fix: transcribe all Telegram voice messages, not just mention-gated...
by MisterGuy420 · 2026-02-15
83.9%
#8310: feat(telegram): Add allowBots support for groups (parity with Disco...
by vishaltandale00 · 2026-02-03
78.3%
#17748: fix: transcribe voice messages in Telegram DMs (v2)
by Limitless2023 · 2026-02-16
77.9%
#20155: feat(telegram): add tg-network-guard transcript status + reply flow
by artemgetmann · 2026-02-18
77.2%
#14057: feat(telegram): add ignoreMediaTypes config to skip specific inboun...
by pavelsamoylenko · 2026-02-11
77.0%
#19869: feat(telegram): add disableWebPagePreview option
by bip-bup-bip-bup · 2026-02-18
76.9%
#14443: fix(telegram): skip General topic thread ID for all chat types (#14...
by lailoo · 2026-02-12
76.8%
#13389: feat(telegram): support native voice notes with automatic OGG/Opus ...
by leavingme · 2026-02-10
76.1%
#6457: fix(telegram): register commands for group scope + preserve topic t...
by dae-sun · 2026-02-01
76.1%
#15914: feat: add messages.suppressMediaPlaceholders config option
by Shuai-DaiDai · 2026-02-14
75.7%