Skip to content
ย 
ย 

Latest commit

ย 

History

2,197 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

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, Redis, 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/
โ”‚   โ”œโ”€โ”€ 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)

โšก Key Features

  • ๐ŸŽต 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 .txt transcript archiving.
  • ๐Ÿ“œ Granular Event & Audit Logging: Multi-category logging system supporting 18 event triggers with customizable channel targets, managed via /set or the web dashboard.
  • ๐Ÿ—„๏ธ Automatic Database Migrations: pnpm dev and pnpm start automatically execute prisma db push on launch before the bot process starts.
  • ๐Ÿ”‘ Native YouTube Device Flow OAuth:
    • Automated device-code prompt displayed directly in the terminal console, plus the /youtube-auth slash 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}" in application.yml) prevents .env disk corruption.
  • ๐ŸŒ 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 dev and pnpm start automatically 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).

๐Ÿ“‹ System Requirements

  • 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

๐Ÿš€ Quick Start Guide

1. Clone & Install Dependencies

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

2. Configure Environment Variables

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

cp .env.example .env

Fill in your mandatory Discord and database credentials:

  • DISCORD_TOKEN: Bot token from Discord Developer Portal
  • DISCORD_CLIENT_ID & DISCORD_CLIENT_SECRET: Application OAuth2 credentials
  • DATABASE_URL & SHADOW_DB_URL: PostgreSQL connection strings
  • REDIS_HOST & REDIS_PORT: Redis cache connection details
  • LAVA_ENABLED: Set to true to enable Lavalink audio playback (defaults to false)

3. Run Development Stack

pnpm dev

The unified launcher will automatically synchronize your Prisma schema (prisma db push), clear lingering ports, and start all services concurrently.


๐ŸŽต YouTube OAuth Setup

When launching for the first time without a YouTube refresh token:

  1. Lavalink's youtube-plugin triggers the OAuth device flow.
  2. The launcher displays a prompt in the terminal console containing the link (https://www.google.com/device) and user code (XXXX-XXXX).
  3. Visit the link in your browser and authorize the device code.
  4. The launcher automatically captures the issued token, saves it atomically to .youtube-oauth.json, and updates process.env.YOUTUBE_REFRESH_TOKEN.
  5. Lavalink binds the token natively via ${YOUTUBE_REFRESH_TOKEN} in application.yml and Java system properties without modifying .env on disk.

You can also re-trigger authorization any time with the /youtube-auth command (Owner only).


๐Ÿ“– Available Commands

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 /set subcommands, see the Commands Reference.

๐ŸŽต Music

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

๐Ÿ”จ Moderation

Command Description
/ban Ban a member
/kick Kick a member
/timeout Timeout (mute) a member
/slowmode Set channel slowmode
/purge Bulk delete messages

โš™๏ธ Utility, Games & Owner

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

๐Ÿณ Docker Deployment

To run the complete stack (Bot, Dashboard, PostgreSQL, Redis, Lavalink v4) in containerized mode:

docker compose --env-file docker.env up -d --build

๐Ÿ“š Documentation & Wiki

For detailed architecture guides, deployment steps, and API credential instructions, visit the project Wiki:


๐Ÿ‘ฅ Contributors โค๏ธ

โญ Bacon Fixation โญ - Countless 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, minor tweaks
  • navidmafi - LeaveTimeOut and MaxResponseTime options, update issue template, fix leave command
  • Kyoyo - added back now-playing
  • MontejoJorge - added 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