|
| 1 | +# 🤖 Master-Bot Discord Application (`@master-bot/bot`) |
| 2 | + |
| 3 | +The Discord client application for **Master-Bot**, built with [Sapphire Framework](https://www.sapphirejs.dev/), [discord.js v14](https://discord.js.org/), [Lavalink v4 (`lavalink-client`)](https://github.com/lavalink-devs/Lavalink), and [Prisma ORM](https://www.prisma.io/). |
| 4 | + |
| 5 | +--- |
| 6 | + |
| 7 | +## 🏗️ Architecture & Directory Structure |
| 8 | + |
| 9 | +```text |
| 10 | +apps/bot/ |
| 11 | +├── src/ |
| 12 | +│ ├── commands/ # 74 Sapphire chat input (slash) commands |
| 13 | +│ │ ├── gifs/ # Klipy & Waifu.im reaction commands |
| 14 | +│ │ ├── moderation/ # Ban, kick, purge, slowmode, timeout |
| 15 | +│ │ ├── music/ # Lavalink audio playback & playlist suite |
| 16 | +│ │ ├── other/ # Utilities, games, polls, reminders, news |
| 17 | +│ │ └── twitch/ # Twitch status monitor |
| 18 | +│ ├── lib/ # Internal business logic and class modules |
| 19 | +│ │ ├── games/ # Connect 4, Tic-Tac-Toe, Rock-Paper-Scissors |
| 20 | +│ │ ├── gifs/ # Media scrapers & fetchers |
| 21 | +│ │ ├── music/ # Queue, Track, Lavalink node managers, NowPlaying embeds |
| 22 | +│ │ ├── presence/ # Dynamic rotating presence status manager |
| 23 | +│ │ ├── reminders/ # Background reminder cron scheduler |
| 24 | +│ │ ├── structures/ # ExtendedClient and CommandHelp interfaces |
| 25 | +│ │ └── twitch/ # Twitch token and live stream checkers |
| 26 | +│ ├── listeners/ # Sapphire event listeners |
| 27 | +│ │ ├── guild/ # Guild member add/remove, role updates, channel events |
| 28 | +│ │ ├── interaction/ # Slash commands, autocomplete, and error handlers |
| 29 | +│ │ ├── music/ # Lavalink node connection and track lifecycle events |
| 30 | +│ │ └── tempchannels/ # Temporary voice channel lifecycle management |
| 31 | +│ ├── preconditions/ # Sapphire preconditions (isCommandDisabled, permissions) |
| 32 | +│ └── env.ts # Type-safe environment validation |
| 33 | +├── package.json |
| 34 | +└── tsconfig.json |
| 35 | +``` |
| 36 | + |
| 37 | +--- |
| 38 | + |
| 39 | +## ⚡ Key Features & Subsystems |
| 40 | + |
| 41 | +1. **🎵 Lavalink v4 Audio Playback**: |
| 42 | + - YouTube multi-client failover with automated OAuth device token capture. |
| 43 | + - Spotify metadata resolution via `lavasrc-plugin`. |
| 44 | + - Free built-in SoundCloud track search and playback. |
| 45 | + - Interactive channel now-playing embeds with live 5-second ASCII progress bars. |
| 46 | + - Audio DSP filters: Bassboost, Karaoke, Nightcore, Vaporwave. |
| 47 | +2. **🔨 Moderation Suite**: |
| 48 | + - Slash commands with hierarchy safety checks and automated audit logging. |
| 49 | +3. **🎫 Support Tickets**: |
| 50 | + - Thread-based ticketing system with interactive buttons (`ticket_create`, `ticket_close`) and `.txt` transcript archiving. |
| 51 | +4. **⏰ Scheduled Reminders**: |
| 52 | + - In-memory background scheduler checking database reminders every 30 seconds. |
| 53 | +5. **📜 Audit Logging**: |
| 54 | + - 18 granular server event listeners routing formatted embeds to designated log channels. |
| 55 | + |
| 56 | +--- |
| 57 | + |
| 58 | +## 🚀 Running & Building |
| 59 | + |
| 60 | +From the workspace root: |
| 61 | + |
| 62 | +```bash |
| 63 | +# Build the bot TypeScript application |
| 64 | +pnpm --filter @master-bot/bot build |
| 65 | + |
| 66 | +# Launch the bot in development watch mode |
| 67 | +pnpm --filter @master-bot/bot dev |
| 68 | + |
| 69 | +# Launch full development stack (Bot + Dashboard + Lavalink) |
| 70 | +pnpm dev |
| 71 | +``` |
0 commit comments