Skip to content

feat(telegram): add voice message transcription support#16

Draft
geminixiang wants to merge 1 commit into
mainfrom
feat/telegram-voice-input
Draft

feat(telegram): add voice message transcription support#16
geminixiang wants to merge 1 commit into
mainfrom
feat/telegram-voice-input

Conversation

@geminixiang

Copy link
Copy Markdown
Owner

Summary

  • Telegram bot now receives voice notes, audio files, and video notes (previously silently dropped)
  • Transcribes audio to text via OpenRouter chat completions API (configurable STT provider/model)
  • Original audio files preserved as attachments alongside transcribed text
  • Graceful fallback: if STT is not configured or fails, audio is still saved as attachment with placeholder text

Configuration

{
  "sttProvider": "openrouter",
  "sttModel": "google/gemini-2.5-flash"
}

Requires OPENROUTER_API_KEY environment variable (or other provider key).

Changed files

  • src/config.tssttProvider / sttModel fields in AgentConfig
  • src/adapters/telegram/transcribe.ts — New transcription module
  • src/adapters/telegram/bot.ts — Voice/audio/video_note handling + transcription integration
  • src/main.ts — Wires STT config to TelegramBot
  • Tests: 16 new test cases across 2 test files

Test plan

  • Set sttProvider/sttModel in settings.json and send a voice note to the bot
  • Verify transcribed text appears in bot response and log.jsonl
  • Verify original .ogg file saved in attachments/
  • Test without STT config — voice should save as attachment with placeholder text
  • npm test passes (162 tests)

🤖 Generated with Claude Code

Receive voice notes, audio files, and video notes from Telegram and
transcribe them to text via OpenRouter (or other providers) using
multimodal chat completions API. Original audio files are preserved
as attachments. STT provider/model configurable via settings.json
(sttProvider/sttModel) or environment variables.

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

1 participant