Skip to content
 
 

Repository files navigation

🤖 Master-Bot

TypeScript Node.js pnpm Lavalink License: MIT PRs Welcome

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 (SQLite), and Lavalink v4.


🏗️ Project Architecture & Structure

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/
│   ├── auth/                # Shared NextAuth.js (Discord OAuth) Configuration
│   ├── config/              # Shared Tooling Config (eslint/, tailwind/)
│   └── db/                  # Shared Prisma ORM Client & SQLite Schema
├── 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, Configuration, Commands)
├── logs/                    # Service-specific log files (bot.log, dashboard.log, lavalink.log)
├── packages/db/prisma/       # Prisma schema + db.sqlite (auto-created on install)
├── application.yml.example  # Lavalink v4 Configuration Template (copy to application.yml)
├── Dockerfile               # Containerized single-service deployment
└── docker-compose.yml       # Stack orchestration helpers (legacy; see the Wiki)

🔄 Note: the project has migrated from a managed database server to SQLite. docker-compose.yml and the launcher helpers still contain some legacy service wiring that hasn't been migrated yet — for accurate deployment today, follow the Deployment Wiki.


⚡ Key Features

  • 🎵 High-Performance Audio Engine: Powered by Lavalink v4 with support for YouTube (multi-client + OAuth), Spotify metadata resolution (lavasrc-plugin), free built-in SoundCloud, Twitch, Vimeo, and direct audio streams. Includes interactive channel player embeds with real-time progress bars and audio filters (/bassboost, /karaoke, /nightcore, /vaporwave).
  • 📚 Custom Playlists: Per-user, per-server playlists via /create-playlist, /save-to-playlist, /my-playlists, /display-playlist, /delete-playlist, and /remove-from-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, thread management, a configurable manager role, and .txt transcript archiving.
  • 📜 Granular Audit Logging: 20 event triggers across members, messages, channels, roles, voice, and moderation — tuned per server via /set or the dashboard.
  • 🗄️ Zero-Ops Database: SQLite via Prisma. The schema is generated and pushed automatically on pnpm install; no database server to install or manage.
  • 🔑 Native YouTube Device-Flow OAuth: /youtube-auth authorizes a streaming account; the refresh token persists to .youtube-oauth.json without rewriting .env.
  • 🌐 Interactive Web Dashboard: Next.js 15 App Router command center — per-server studios for welcome messages, audit logs, tickets, reminders, per-command toggles, music, broadcasts, integrations, and system telemetry.
  • 🎯 Feature Flags: Individual bot modules (Lavalink audio, GIFs, Twitch, News, IGDB) can be enabled or disabled via environment variables.
  • 🚀 Cross-Platform Unified Launchers: pnpm dev and pnpm start manage ports, 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).

📋 System Requirements

  • Node.js: >=20.0.0
  • pnpm: >=8.0.0 (npm install -g pnpm)
  • Java: Java 17+ (21 LTS recommended) — only required for a local Lavalink server (music)
  • Database: None — SQLite file (db.sqlite) is created automatically

🚀 Quick Start Guide

1. Clone & Install Dependencies

git clone https://github.com/galnir/Master-Bot.git
cd Master-Bot
pnpm install

pnpm install generates the Prisma client and creates the SQLite database (db.sqlite).

2. Configure Environment Variables

Create .env in the workspace root from .env.example:

cp .env.example .env

Fill in your mandatory credentials:

  • DISCORD_TOKEN: Bot token from the Discord Developer Portal
  • DISCORD_CLIENT_ID & DISCORD_CLIENT_SECRET: Application OAuth2 credentials
  • NEXTAUTH_SECRET: Random 32+ character signing secret
  • NEXTAUTH_URL: Public dashboard URL (e.g. http://localhost:3000)

Optional audio/feature keys (Spotify, YouTube, Twitch, News, Genius, Klipy) and the LAVA_* + feature-flag variables are documented in the Configuration Wiki.

3. Run the Stack

pnpm dev

Starts the bot, dashboard, and (when LAVA_ENABLED=true and Java is present) a local Lavalink server with a unified status console and logs/. For production: pnpm build && pnpm start.


🎵 YouTube OAuth Setup

  1. Run /youtube-auth in Discord (or the terminal device-flow prompt at first launch).
  2. Open the returned URL, log in with the YouTube account you want to stream through, and approve the scopes.
  3. The bot stores the refresh token atomically in .youtube-oauth.json and keeps a YOUTUBE_REFRESH_TOKEN binding for Lavalink.

Authorized playback defeats YouTube throttling/blocking. See Music & Lavalink.


📖 Available Commands

Master-Bot ships with 74 slash commands across Music, Moderation, GIFs, Games, Utilities, News, and Reminders. For the complete, up-to-date list and the /set subcommands, see the Commands Reference.

Category Highlights
🎵 Music /play, /queue, /shuffle, /jump, /seek, /volume, /lyrics, /bassboost, /music-trivia, playlists, /youtube-auth
🔨 Moderation /ban, /kick, /timeout, /slowmode, /purge
⚙️ Utility /set, /help, /reminder, /poll, /weather, /translate, /world-news, /8ball, /reddit, /urban
🎮 Games /connect-four, /tic-tac-toe, /rockpaperscissors, /game-search
😂 GIFs /gif, /hug, /waifu, /cat, /doggo, /slap, and more
🟣 Twitch /twitch-status + live stream alerts via /set twitch

🐳 Docker Deployment

A portableDockerfile (node:20-slim, port 3000) is included. For single-service container deployment, a cloud walkthrough, and persistence guidance, see Deployment Wiki.


📚 Documentation & Wiki

Visit the Wiki for full documentation:


👥 Contributors ❤️

Bacon Fixation — countless contributions across the project.

Contributor Contributions
ModoSN resolve-ip, rps, 8ball, bored, trump, advice, kanye, urban dictionary commands 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-trivia and Dockerfile improvements
navidmafi LeaveTimeOut and MaxResponseTime options, update issue template, fix leave command
Kyoyo brought back now-playing
MontejoJorge brought back remind
malokdev uptime command
chimaerra minor command tweaks

🤝 Contributing

We welcome contributions of all kinds! Please read our Contributing Guidelines to get started with local setup, coding standards, and pull request workflows.


📄 License

Distributed under the MIT License. See LICENSE.md for more information.

About

A Discord music bot and dashboard with slash commands, playlist support, Spotify, music quiz, saved playlists, lyrics, gifs and more

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages