← Back to PRs

#15394: telegram: treat mp3 as voice-compatible when asVoice=true

by SnugMorg open 2026-02-13 11:33 View on GitHub →
channel: telegram stale size: XS
Summary This PR makes Telegram treat MP3 as voice-compatible when asVoice=true, so messages are sent as voice notes (sendVoice) instead of regular audio files (sendAudio). Problem: Currently, voice compatibility accepts only OGG/OPUS (.oga/.ogg/.opus and ogg/opus mime). Common TTS output is MP3, so asVoice=true can fall back to audio file behavior. Change Added .mp3 to VOICE_AUDIO_EXTENSIONS Extended mime compatibility check to include [SNIPPETS-BEFORE-AFTER.md](https://github.com/user-attachments/files/25288803/SNIPPETS-BEFORE-AFTER.md) mp3 Why This improves UX consistency: when voice is requested, Telegram receives a voice note bubble. Validation Reproduced on OpenClaw 2026.2.12 Before: asVoice=true + mp3 -> sendAudio After: asVoice=true + mp3 -> sendVoice <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> This change expands `isVoiceCompatibleAudio` (`src/media/audio.ts`) to treat MP3 (`.mp3` / MIME containing `mp3`) as “voice-compatible”, which makes Telegram’s `asVoice=true` decision route MP3 audio through `sendVoice` instead of `sendAudio`. The main follow-up needed before merge is updating the Telegram unit test(s) that currently encode the old behavior (MP3 not voice-compatible), otherwise the test suite will no longer match the new intended routing. <h3>Confidence Score: 3/5</h3> - This PR is small and localized, but it requires updating existing Telegram tests that will now be incorrect. - The implementation change is straightforward (extension + MIME substring check), but an existing unit test explicitly expects MP3 to fall back to sendAudio; without test updates the PR will be inconsistent with repo expectations. Tooling limitations in this environment prevented running the test suite to confirm. - src/telegram/send.returns-undefined-empty-input.test.ts (and any other Telegram send tests asserting MP3 fallback) <sub>Last reviewed commit: 1450c17</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