← Back to PRs

#23067: feat(telegram): add disableAudioPreflight config for groups and topics

by yangnim21029 open 2026-02-22 00:07 View on GitHub →
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