Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@foeken
Copy link
Contributor

@foeken foeken commented Jan 25, 2026

Summary

  • When TTS auto mode is enabled, slash commands like /status would fail silently because sendVoice was rejected with VOICE_MESSAGES_FORBIDDEN
  • The entire reply would fail without any text being sent, making it appear as if the bot wasn't responding
  • This adds error handling to catch VOICE_MESSAGES_FORBIDDEN specifically and fall back to sending the text content as a regular message

Problem

When a Telegram chat/user has voice messages disabled (privacy setting or bot restriction), any reply with TTS enabled would completely fail:

[telegram] slash final reply failed: GrammyError: Call to 'sendVoice' failed! (400: Bad Request: VOICE_MESSAGES_FORBIDDEN)

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 sendVoice call with this error.

Users experiencing this can either:

  1. Adjust their Telegram privacy settings to allow voice messages from bots
  2. Keep TTS enabled and let the fallback handle it (this PR)
  3. Disable TTS auto mode in their Clawdbot config (messages.tts.auto: "off")

Solution

Added try-catch around sendVoice that:

  1. Catches VOICE_MESSAGES_FORBIDDEN errors specifically
  2. Falls back to sending the text content via sendMessage instead
  3. Re-throws other errors (network issues, auth problems, etc.) so they're still reported

Test plan

  • Added test for VOICE_MESSAGES_FORBIDDEN fallback behavior
  • Added test to ensure other errors are still thrown
  • Existing delivery tests pass

🤖 Generated with Claude Code

@foeken foeken force-pushed the fix/telegram-voice-fallback branch from 377d3ba to ae84ea8 Compare January 25, 2026 07:30
@steipete steipete self-assigned this Jan 25, 2026
Echo and others added 2 commits January 25, 2026 13:15
When TTS auto mode is enabled, slash commands like /status would fail
silently because sendVoice was rejected with VOICE_MESSAGES_FORBIDDEN.
The entire reply would fail without any text being sent.

This adds error handling to catch VOICE_MESSAGES_FORBIDDEN specifically
and fall back to sending the text content as a regular message instead
of failing completely.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@steipete steipete force-pushed the fix/telegram-voice-fallback branch from ae84ea8 to 58f3681 Compare January 25, 2026 13:18
@steipete steipete merged commit 9bd5def into openclaw:main Jan 25, 2026
@steipete
Copy link
Contributor

Landed via temp rebase onto main.

  • Gate: pnpm lint (failed: typescript-eslint no-redundant-type-constituents in src/line/types.ts, existing); pnpm build (failed: missing @line/bot-sdk types), pnpm test (not run)
  • Land commit: $land_sha
  • Merge commit: $merge_sha

Thanks @$contrib!

steipete added a commit to orlyjamie/clawdbot that referenced this pull request Jan 25, 2026
…law#1725)

* fix(telegram): fall back to text when voice messages forbidden

When TTS auto mode is enabled, slash commands like /status would fail
silently because sendVoice was rejected with VOICE_MESSAGES_FORBIDDEN.
The entire reply would fail without any text being sent.

This adds error handling to catch VOICE_MESSAGES_FORBIDDEN specifically
and fall back to sending the text content as a regular message instead
of failing completely.

Co-Authored-By: Claude Opus 4.5 <[email protected]>

* fix: handle telegram voice fallback errors (openclaw#1725) (thanks @foeken)

---------

Co-authored-by: Echo <[email protected]>
Co-authored-by: Claude Opus 4.5 <[email protected]>
Co-authored-by: Peter Steinberger <[email protected]>
mcinteerj pushed a commit to mcinteerj/moltbot that referenced this pull request Jan 25, 2026
…law#1725)

* fix(telegram): fall back to text when voice messages forbidden

When TTS auto mode is enabled, slash commands like /status would fail
silently because sendVoice was rejected with VOICE_MESSAGES_FORBIDDEN.
The entire reply would fail without any text being sent.

This adds error handling to catch VOICE_MESSAGES_FORBIDDEN specifically
and fall back to sending the text content as a regular message instead
of failing completely.

Co-Authored-By: Claude Opus 4.5 <[email protected]>

* fix: handle telegram voice fallback errors (openclaw#1725) (thanks @foeken)

---------

Co-authored-by: Echo <[email protected]>
Co-authored-by: Claude Opus 4.5 <[email protected]>
Co-authored-by: Peter Steinberger <[email protected]>
rodrigouroz pushed a commit to rodrigouroz/moltbot that referenced this pull request Jan 26, 2026
…law#1725)

* fix(telegram): fall back to text when voice messages forbidden

When TTS auto mode is enabled, slash commands like /status would fail
silently because sendVoice was rejected with VOICE_MESSAGES_FORBIDDEN.
The entire reply would fail without any text being sent.

This adds error handling to catch VOICE_MESSAGES_FORBIDDEN specifically
and fall back to sending the text content as a regular message instead
of failing completely.

Co-Authored-By: Claude Opus 4.5 <[email protected]>

* fix: handle telegram voice fallback errors (openclaw#1725) (thanks @foeken)

---------

Co-authored-by: Echo <[email protected]>
Co-authored-by: Claude Opus 4.5 <[email protected]>
Co-authored-by: Peter Steinberger <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants