Link in, card, download, send, in private chats and groups. - cmd/core with an embedded download worker - Telegram front end on telego v1.13.0 (Bot API 10.4): link card with thumbnail and format buttons, one live status message, /dl /audio /thumb /info /queue /cancel, group support with requester-only buttons - Database backed queue: paid and free lanes, leases with heartbeats, one automatic retry, cancel, queue position and wait estimate - yt-dlp and ffprobe behind a Runner interface with classified, redacted errors mapped to friendly messages - SQLite via modernc with goose migrations, portable schema - Local file storage behind a Storage interface - go-i18n with an English catalog, no literal text in handlers - Free tier limits enforced before queueing and again on the real file - Bot token and webhook secret are stripped from all log output - Tests: URL parsing, job lifecycle, worker, yt-dlp wrapper, and end to end flows against a fake Bot API server; opt-in test with the real yt-dlp Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The Noderunners Download Bot
A Telegram bot that downloads video and audio from links, in private chats and in groups. Written in Go on top of yt-dlp.
Status: Phase 1 of 8 (core bot). Payments, the cache, remote workers, group settings, the Mini App and more languages follow. See docs/ASSUMPTIONS.md for the decisions made so far.
What works today
- Send a link in a private chat and get a card with title, thumbnail, duration and format buttons: Best, 720p, 480p, MP3, Thumbnail, Cancel.
- In groups:
/dl <link>, or reply/dlto a message with a link. Buttons only work for the person who asked. - One status message, edited live: queued with position and wait, downloading with a progress bar, processing, sending, done.
- A database backed queue with leases, one automatic retry and cancel.
- Free tier limits: size, duration, one active job, bounded queue.
- Friendly, translated error messages. Raw tool output stays in the logs.
Quick start
You need Go 1.26.11 or newer (older Go toolchains download it on their
own), plus yt-dlp and ffmpeg on the PATH.
# 1. Create a bot with @BotFather and copy its token.
cp .env.example .env
$EDITOR .env # set BOT_TOKEN
# 2. Build and run.
make build
./bin/core
Open your bot in Telegram, press Start and send it a link.
To use the bot in a group, add it to the group. Group privacy mode can stay on: the bot only needs to see commands.
Check that it is alive
curl localhost:8080/healthz
# {"status":"ok"}
Commands
| Command | What it does |
|---|---|
/start |
Welcome message |
/help |
Usage and your limits |
/dl <link> |
Download a video. In groups also works as a reply to a link. |
/audio <link> |
Download the audio as MP3 |
/thumb <link> |
Send the thumbnail |
/info <link> |
Show formats and sizes without downloading |
/queue |
Your downloads in progress |
/cancel |
Cancel your downloads |
Configuration
Everything is configured through environment variables. .env.example
lists all of them with comments. A TOML file with the same settings is
optional, see config.example.toml; the environment overrides the file.
The settings you are most likely to touch:
| Variable | Default | Meaning |
|---|---|---|
BOT_TOKEN |
none | Token from @BotFather. Required. |
TELEGRAM_MODE |
polling |
polling or webhook |
WORKER_CONCURRENCY |
2 |
Downloads running at the same time |
FREE_MAX_SIZE_MB |
50 |
Size cap per download |
FREE_MAX_DURATION |
10m |
Duration cap per download |
FREE_ACTIVE_JOBS |
1 |
Active downloads per user |
QUEUE_FREE_MAX_LEN |
20 |
Most queued free jobs |
DB_DSN |
data/dlbot.db |
SQLite file |
LOG_LEVEL |
info |
debug, info, warn, error |
Development
make check # gofmt, go vet, tests with the race detector
make test # tests only
make e2e # real yt-dlp against a public test file, needs network
The tests need neither a bot token nor network access. They run the real
bot against a fake Bot API server (internal/tg/fakeserver) and a scripted
yt-dlp.
Documentation
- docs/ARCHITECTURE.md: how the pieces fit.
- docs/ASSUMPTIONS.md: decisions and verified facts.
Layout
cmd/core the bot gateway (and, for now, the embedded worker)
internal/bot Telegram handlers, cards, status, delivery
internal/service download rules shared by all front ends
internal/sched the job queue
internal/worker the download worker
internal/ytdlp yt-dlp and ffprobe wrapper
internal/db migrations and queries
internal/storage file storage backends
internal/i18n translations and formatting
locales translation catalogs
docs architecture and assumptions