fix(telegram): fall back to text when voice messages forbidden #1725
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
/statuswould fail silently becausesendVoicewas rejected withVOICE_MESSAGES_FORBIDDENVOICE_MESSAGES_FORBIDDENspecifically and fall back to sending the text content as a regular messageProblem
When a Telegram chat/user has voice messages disabled (privacy setting or bot restriction), any reply with TTS enabled would completely fail:
This meant
/status,/help, and other slash commands appeared broken when TTS auto mode was enabled.Why does VOICE_MESSAGES_FORBIDDEN happen?
This is a Telegram Premium privacy feature. Premium users can block voice/video messages in Settings > Privacy and Security > Voice Messages. They can choose who's allowed to send them voice messages (everyone, contacts only, nobody, etc.).
If the recipient has this restriction enabled and the bot isn't on their allowed list, Telegram rejects the
sendVoicecall with this error.Users experiencing this can either:
messages.tts.auto: "off")Solution
Added try-catch around
sendVoicethat:VOICE_MESSAGES_FORBIDDENerrors specificallysendMessageinsteadTest plan
🤖 Generated with Claude Code