[ CASE STUDY · FLAGSHIP 02 ]

Pixel-Assistor

Production Discord automation platform replacing multiple single-purpose bots — moderation, Lavalink audio, multi-chain crypto, games and utilities.

123 commands loaded8 categories147 tests passingDiscord.js v14SQLite + MongoDBPM2 · live 24/7

Measured 2026-09-13 via the repo's own loader (handlers/commandHandler): 123 files across 8 categories — admin 13 · crypto 4 · extra 3 · fun 3 · games 5 · moderation 52 · upi 5 · utility 38. Older README copy says 124; the loader count (123) is authoritative. 147/147 tests green via npm test (node --test).

01 — Problem

Communities juggle five single-purpose bots with conflicting permissions, overlapping prefixes and uncorrelated downtime. Moderation, music, crypto tracking, games and utilities each live in a different codebase with a different trust model.

02 — Solution & Architecture

One hardened Discord.js v14 bot: a dynamic filesystem loader decouples 123 slash commands across 8 directories (hot-reload per command, no restarts); a remote Lavalink node handles audio demuxing/Opus encoding; a uniform repository pattern switches between SQLite (better-sqlite3, WAL) and MongoDB without touching command code.

commands/ — admin(13) crypto(4) extra(3) fun(3) games(5) moderation(52) upi(5) utility(38)
handlers/ — commandHandler, commandPipeline, eventHandler
events/ — 13 dispatchers: interactionCreate, messageCreate, guildMemberAdd, …
utils/ — perms, cooldowns, cryptoApi, mathEval, reminderPoller, transcriptServer…
test/ — 13 files, 147 tests (registry smoke, perms hierarchy, red-team, crypto…)

03 — Engineering challenges

How do 123 commands stay maintainable?

Metadata contracts: the registry smoke test asserts every command exports name/execute/category and blocks duplicate aliases — failures break the suite before they reach production.

How does audio stay low-latency?

Demuxing and Opus encoding are offloaded to an external Java Lavalink node, keeping the Node.js event loop free for gateway events.

How does it stay up 24/7?

PM2 process management with crash recovery, background reminder/timer pollers and rate-limited auto-mod — running live on this host (pixel-discord-bot: online).

04 — Security

05 — Testing

06 — Result

One bot replacing a rack of single-purpose bots — with a registry that enforces its own contracts, security tests that attack its own permissions, and a process manager that keeps it online. Verify it: read the loader, run the suite, check PM2.