Master-Bot is a production-ready, high-performance Discord Music and Utility Bot with a full-featured Next.js Web Dashboard. Built with TypeScript, Sapphire Framework, discord.js v14, Next.js 15, tRPC v11, Prisma ORM, Redis, and Lavalink v4.
Master-Bot is organized as a Turborepo workspace managed with pnpm:
Master-Bot/
โโโ apps/
โ โโโ bot/ # Sapphire & Discord.js v14 Bot Application
โ โโโ dashboard/ # Next.js 15 Web Dashboard (Tailwind CSS, NextAuth, tRPC)
โโโ packages/
โ โโโ api/ # Shared tRPC v11 Routers & API Procedures
โ โโโ auth/ # Shared NextAuth.js Configuration
โ โโโ config/ # Shared Tooling Config (eslint/, tailwind/)
โ โโโ db/ # Shared Prisma ORM Client & Database Schemas
โโโ scripts/
โ โโโ common.mjs # Shared cross-platform port management & log writers
โ โโโ dev.mjs # Unified Development Launcher & Service Manager
โ โโโ start.mjs # Unified Production Launcher & Service Manager
โโโ wiki/ # Project documentation (Setup, Lavalink, API keys, Commands)
โโโ logs/ # Service-specific log files (bot.log, dashboard.log, lavalink.log)
โโโ application.yml.example # Lavalink v4 Configuration Template (copy to application.yml)
โโโ docker-compose.yml # Containerized deployment (Bot, Dashboard, PostgreSQL, Redis, Lavalink)
- ๐ต High-Performance Audio Engine: Powered by Lavalink v4 with support for YouTube (multi-client failover), Spotify metadata resolution (
lavasrc-plugin), free built-in SoundCloud, Twitch, Vimeo, and direct audio streams. Includes interactive channel player embeds with real-time ASCII progress bars (00:00 โฐโฐโฐโฐโฐโฐโฑโฑโฑโฑโฑ 03:45) and audio filters (/bassboost,/karaoke,/nightcore,/vaporwave). - ๐ Custom Playlists: Per-user saved playlists via
/create-playlist,/save-to-playlist,/my-playlists,/display-playlist, and/delete-playlist. - ๐จ Full Moderation Suite: Dedicated slash commands (
/ban,/kick,/slowmode,/timeout,/purge) with permission hierarchy validation and safety checks. - ๐ซ Thread-Based Support Ticket System: Interactive ticket panel with auto-posting buttons (
ticket_create,ticket_close), thread management, dynamic greeting templates ({user},{username},{server}), and secure.txttranscript archiving. - ๐ Granular Event & Audit Logging: Multi-category logging system supporting 18 event triggers with customizable channel targets, managed via
/setor the web dashboard. - ๐๏ธ Automatic Database Migrations:
pnpm devandpnpm startautomatically executeprisma db pushon launch before the bot process starts. - ๐ Native YouTube Device Flow OAuth:
- Automated device-code prompt displayed directly in the terminal console, plus the
/youtube-authslash command (Owner only). - Tokens persist atomically to
.youtube-oauth.json(via write-to-temp + atomic rename), so no re-authentication is needed after restart. - Native Spring environment variable binding (
refreshToken: "${YOUTUBE_REFRESH_TOKEN}"inapplication.yml) prevents.envdisk corruption.
- Automated device-code prompt displayed directly in the terminal console, plus the
- ๐ Interactive Web Dashboard: Modern Next.js 15 App Router dashboard with Discord OAuth login, server settings, custom welcome & ticket message editors with live previews, audit log controls, command panel, and an owner log viewer.
- ๐ฏ Feature Flags: Individual bot modules (Lavalink audio, GIFs, Twitch, News, IGDB) can be enabled or disabled dynamically via environment variables.
- ๐ Cross-Platform Unified Launchers:
pnpm devandpnpm startautomatically manage ports, clear lingering processes, route output to isolated log files (logs/), and present a clean console status UI. - ๐ผ๏ธ Reaction GIFs & Media: Powered by Klipy API and Waifu.im (
/gif,/hug,/waifu,/cat,/doggo, and more). - ๐ฎ Gaming & Info: Live Twitch channel alerts, IGDB game search, TVMaze TV show info, and a suite of fun utilities (
/8ball,/urban,/trump,/kanye,/translate, and more).
- Node.js:
>=20.0.0 - pnpm:
>=8.0.0(npm install -g pnpm) - Java: Java 17+ required ยท Java 21 LTS recommended (Required for Lavalink v4)
- PostgreSQL: PostgreSQL database server
- Redis: Redis server for queue state and caching
git clone https://github.com/galnir/Master-Bot.git
cd Master-Bot
pnpm installCreate .env in the root workspace directory from .env.example:
cp .env.example .envFill in your mandatory Discord and database credentials:
DISCORD_TOKEN: Bot token from Discord Developer PortalDISCORD_CLIENT_ID&DISCORD_CLIENT_SECRET: Application OAuth2 credentialsDATABASE_URL&SHADOW_DB_URL: PostgreSQL connection stringsREDIS_HOST&REDIS_PORT: Redis cache connection detailsLAVA_ENABLED: Set totrueto enable Lavalink audio playback (defaults tofalse)
pnpm devThe unified launcher will automatically synchronize your Prisma schema (prisma db push), clear lingering ports, and start all services concurrently.
When launching for the first time without a YouTube refresh token:
- Lavalink's
youtube-plugintriggers the OAuth device flow. - The launcher displays a prompt in the terminal console containing the link (
https://www.google.com/device) and user code (XXXX-XXXX). - Visit the link in your browser and authorize the device code.
- The launcher automatically captures the issued token, saves it atomically to
.youtube-oauth.json, and updatesprocess.env.YOUTUBE_REFRESH_TOKEN. - Lavalink binds the token natively via
${YOUTUBE_REFRESH_TOKEN}inapplication.ymland Java system properties without modifying.envon disk.
You can also re-trigger authorization any time with the /youtube-auth command (Owner only).
Master-Bot ships with 74 slash commands across Music, Moderation, GIFs, Games, Utilities, News, Reminders, and more. For the complete, up-to-date list and the
/setsubcommands, see the Commands Reference.
| Command | Description |
|---|---|
/play |
Play a song, playlist, or search query |
/jump |
Jump to a specific track in the queue |
/music-trivia |
Start an interactive music trivia game |
/create-playlist |
Create a custom user playlist |
/help |
Browse commands & detailed help |
| Command | Description |
|---|---|
/ban |
Ban a member |
/kick |
Kick a member |
/timeout |
Timeout (mute) a member |
/slowmode |
Set channel slowmode |
/purge |
Bulk delete messages |
| Command | Description |
|---|---|
/set |
Configure server settings |
/poll |
Create an interactive multi-choice poll with buttons |
/reminder |
Set, list, and manage personal or server reminders |
/weather |
Get current weather and 3-day forecast for any location |
/bored |
Generate a fun, random activity to cure your boredom |
/world-news |
Fetch the latest world news headlines via NewsAPI |
/connect-four |
Play Connect 4 interactively with buttons |
/tic-tac-toe |
Play Tic-Tac-Toe interactively with buttons |
/about |
Display detailed bot, server, or user information |
/youtube-auth |
Re-trigger YouTube OAuth (Owner Only) |
/game-search |
Search video game info via IGDB |
/twitch-status |
Check a Twitch streamer's live status |
/dashboard |
Get a link to the web dashboard |
To run the complete stack (Bot, Dashboard, PostgreSQL, Redis, Lavalink v4) in containerized mode:
docker compose --env-file docker.env up -d --buildFor detailed architecture guides, deployment steps, and API credential instructions, visit the project Wiki:
- ๐ Setup & Deployment Guide
- ๐ฃ Heroku Deployment Guide
- ๐ต Lavalink v4 Setup Guide
- ๐ API Keys & Configuration
- ๐ Complete Commands Reference
โญ Bacon Fixation โญ - Countless contributions
- ModoSN -
resolve-ip,rps,8ball,bored,trump,advice,kanye,urban dictionarycommands and visual updates - PhantomNimbi - GIF commands, Lavalink v4 engine, Next.js 15 migration, moderation suite, support ticket system, live ASCII progress bar & auto-updater
- rafaeldamasceno -
music-triviaand Dockerfile improvements, minor tweaks - navidmafi -
LeaveTimeOutandMaxResponseTimeoptions, update issue template, fix leave command - Kyoyo - added back
now-playing - MontejoJorge - added back
remind - malokdev -
uptimecommand - chimaerra - minor command tweaks
We welcome contributions of all kinds! Please read our Contributing Guidelines to get started with local setup, coding standards, and pull request workflows.
Distributed under the MIT License. See LICENSE.md for more information.