← All work

Discord Music Bot

Developer2026shipped

A music bot for Discord that hands the audio work to two well-tested tools instead of trusting a fragile piece of JavaScript to keep working.

YouTube breaks the tools that read it roughly on schedule. So this one asks yt-dlp only where the audio is, and lets ffmpeg fetch it. When YouTube changes something, the whole repair is updating one file.

Facts

  • Fourteen commands, and no Java, no Python, and no half-broken audio libraries to install
  • Downloading and playing are handled by two mature command-line tools rather than by code that has to be rewritten every time YouTube changes
  • The installer checks the file it downloaded against a fingerprint published alongside it, and refuses to install one that does not match
  • Before it even signs in, it checks that everything it needs is actually there and working
  • Skipping to the middle of a song does not re-download it from the start
  • If a link expires mid-song, it quietly fetches a fresh one and carries on, once, before telling you anything went wrong
  • One audio process per server, shut down cleanly on stop, skip, seek and exit
  • 128 tests run with no internet, no config file and none of the tools installed

Stack

  • Node.js
  • discord.js
  • @discordjs/voice
  • yt-dlp
  • ffmpeg

There is no repository link here because there is no repository. The project was set up deliberately without git, and rollback is a labelled snapshot instead.

Two decisions carry the design. The bot asks yt-dlp only where the audio lives and lets ffmpeg fetch it directly, which is why skipping to the middle of a track is a cheap request rather than a re-download. And changing the volume and skipping ahead turn out to be the same operation, which is why there is no hand-rolled audio path anywhere in this project.

← All work