Skip to content

Repository files navigation

VoiceBot

A Telegram bot that turns voice messages, videos, and audio files into text, using Groq's Whisper API to do the transcription

image

Try it — message @egvoicebot on Telegram

Quick start

Send it a voice message, video note, or audio file. It replies with the transcript. That's the whole flow — no account, nothing to set up on your end

Features

  • Transcribes voice messages, video notes, and most audio/video file formats
  • Runs on Groq's whisper-large-v3 model
  • Show/hide button on the transcript instead of dumping raw text into the chat
  • Talks to a local Telegram Bot API server, so it isn't stuck at Telegram's 20MB limit — files up to 2GB go through fine

Running it locally

You'll need:

  • Python 3.11 (that's what the Docker image runs on — older 3.x will probably work too, just untested)
  • FFmpeg on your PATH, if you're not using Docker — it's what converts video to audio before transcription
  • A Telegram bot token from @BotFather
  • A Groq API key

Clone the repo and install:

git clone https://github.com/egraich/VoiceBot.git
cd VoiceBot
pip install -r requirements.txt

Add a .env file in the project root:

BOT_TOKEN=your_telegram_bot_token
GROQ_API_KEY=gsk_your_groq_api_key_here
ADMIN_ID=your_admin_id
TEMP_DIR=path/to/temp/files/directory
BOT_API_URL=https://api.telegram.org

Then run it:

python main.py

If you'd rather skip installing FFmpeg yourself, there's a Dockerfile that bundles a static build. The docker-compose.yml in this repo is set up for my own Nest server though — hardcoded volume paths, an external Docker network — so treat it as a reference, not something to run as-is.

How it works

Incoming files get downloaded, and if it's video, FFmpeg strips it down to 16kHz mono FLAC before anything gets sent anywhere. Whisper resamples audio to 16kHz internally regardless, so doing that conversion up front just means a smaller upload with no real cost to accuracy.

The transcription request goes to Groq's whisper-large-v3 model asynchronously, so the bot isn't stuck waiting on one file before it can handle the next.

The bigger constraint was file size. Telegram's normal Bot API refuses anything over 20MB, which rules out most voice memos over a couple minutes and basically all video. Running a self-hosted Telegram Bot API server sidesteps that limit entirely, up to 2GB. Usage stats and a small transcription cache live in SQLite via aiosqlite, with PRAGMA journal_mode=WAL on so two people transcribing at once don't lock each other out.

Credits

Made by egraich <3

About

A Telegram bot that converts videos and voice messages into text via Groq API

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages