LightBot was my longest-running side project, from 2018 to 2020. It's a Discord bot that joins a voice channel and plays music on request, with a companion website where you can see and control what's playing.

Features

  • Music playback: play, search, request and queue tracks, with pause, resume, skip, shuffle, repeat and volume controls.
  • Playlists: each server keeps its own playlist, saved in SQLite along with server and user settings.
  • Web control: sign in with Discord to see your servers, then view a server's playlist and send playback commands (skip, shuffle, repeat, volume) to the bot.
  • The usual extras: help, invite links, role lookups and an 8-ball.

How it's built

  • Sharding: the bot runs under discord.js's ShardingManager, so its connection to Discord is split across processes.
  • Socket bridge: the shard manager runs a Socket.io server and a small API, and each shard connects to it as a client, reporting which Discord servers it holds. Commands from the website are routed to the shard that holds that server, and shard logs and stats come back the same way.
  • Structure: commands, event handlers, services and repositories each live in their own modules. The command loader picks up new commands from folders, with permission checks for elevated ones.
  • Front end: the website started as Express with Angular 5. I later rebuilt it as an Angular 14 app.

In late 2020 I moved the bot to discord.js v12 and did a round of stability work. The source is private.

Contact

Want to Know More?

Happy to talk through how this was built. Drop me a message.

Loading pond…