Files
ironclaw/channels-src
Tennyson b6b3ffa1a4 feat(telegram): add sendVoice support for audio/ogg attachments (#1314)
* feat(telegram): add sendVoice support for audio/ogg attachments

When an agent response includes an attachment with MIME type audio/ogg
or audio/opus, the Telegram channel now sends it via sendVoice instead
of sendDocument. This renders the audio as an in-chat voice note with
waveform and playback controls rather than a file download.

Adds:
- VOICE_MIME_TYPES constant for ogg/opus detection
- send_voice() function mirroring send_document() but calling sendVoice
- Updated send_attachment() routing: photo → sendPhoto, ogg/opus → sendVoice, other → sendDocument

This is the channel-side prerequisite for TTS voice replies (issue #90).
The TTS provider infrastructure (TTS_PROVIDER, TTS_BASE_URL, etc.) is
tracked separately in that issue.

* docs: update FEATURE_PARITY.md for sendVoice support

* fix(telegram): address review feedback on sendVoice PR

- Add MAX_VOICE_SIZE (50MB) guard with fallback to send_document
- Extract base_mime_type() to handle parameterized MIME types
  (e.g. "audio/ogg; codecs=opus")
- Extract classify_attachment() pure function for testable routing
- Add unit tests for MIME routing and base_mime_type parsing
- Bump telegram channel version to 0.2.6

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* refactor(telegram): extract send_multipart_upload shared helper

Replace three near-identical multipart upload functions (send_photo,
send_document, send_voice) with a shared send_multipart_upload() that
takes the API method and field name as parameters. Each public function
now handles only its size guard and delegates to the shared helper.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: TheWolfOfWalmart <tenny@tenn-lab.xyz>
Co-authored-by: ilblackdragon@gmail.com <ilblackdragon@gmail.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 13:44:33 -07:00
..