Discord music bot built with Discord.js, discord-player, Prisma, and Supabase. Supports YouTube and Spotify playback, queue management with interactive controls, and English/Russian localization. Access is limited to allowlisted guilds and roles.
- Slash commands for play/search/queue/controls (skip, stop, pause/resume, volume, seek, shuffle, clear, remove, language).
- YouTube and Spotify inputs (tracks and playlists up to 500 items), with Spotify-to-YouTube conversion.
- Now Playing message with button controls and volume adjustments.
- Guild-level allowlist plus role-based permissions.
- Owner-only allowlist onboarding (
/owner allow) usingBOT_OWNER_ID. - English and Russian localization via i18next.
- Prisma ORM backed by Supabase PostgreSQL.
- Runtime: Node.js 24+
- Discord: discord.js 14, discord-player 7
- Data: Prisma 5, Supabase PostgreSQL
- i18n: i18next 25
- Tooling: TypeScript 5, tsx, Vitest
- Node.js 24.x (LTS) and pnpm
- FFmpeg available in PATH
- Supabase PostgreSQL credentials (pooled and direct URLs)
- Discord application with a bot token and client ID
-
Install dependencies
pnpm install -
Configure environment
cp .env.example .envand fill in:
DISCORD_TOKEN/DISCORD_CLIENT_IDDATABASE_URL(Supabase pooled, port 6543) andDIRECT_URL(session, port 5432)- Optional:
SPOTIFY_CLIENT_ID/SPOTIFY_CLIENT_SECRET - Required:
BOT_OWNER_ID(Discord user ID allowed to run/owner allow)
-
Generate Prisma client and sync schema
pnpm run db:generate
pnpm run db:push -
Deploy slash commands to Discord
pnpm run deploy-commands -
Run the bot
Development:pnpm run dev
Production:pnpm run build && pnpm start
pnpm run dev— watch + reload via tsx.pnpm run build— TypeScript compile todist/.pnpm start— run compiled bot.pnpm run deploy-commands— register slash commands.pnpm run db:generate/pnpm run db:push/pnpm run db:studio— Prisma workflows.pnpm test— run Vitest suite (unit tests present).
.
├── src/ # TypeScript sources
│ ├── commands/ # Slash command implementations
│ ├── events/ # Discord event handlers
│ ├── handlers/ # Interaction routing (buttons, menus, player)
│ ├── services/ # Business logic (player, permissions, guild)
│ ├── i18n/ # i18next setup and locales (en/ru)
│ ├── utils/ # Embeds, buttons, validators, logger
│ └── index.ts # Entry point
├── prisma/schema.prisma # Database schema
├── scripts/ # Command deployment
├── tests/ # Vitest unit/integration suites
└── dist/ # Build output
- Allowlist: only guilds in the database can use the bot; guild activity flag enforced.
- Role-based access: if roles are configured for a guild, only those roles may issue commands.
- Owner allowlist activation:
/owner allowupserts/activates the current guild; only the user ID inBOT_OWNER_IDmay run it. - Queue limits: max 500 tracks; track duration and inactivity timeouts configurable via
GuildSettings. - Localization: defaults to English; supports Russian.
- Keep secrets out of version control (
DISCORD_TOKEN,DISCORD_CLIENT_ID,DATABASE_URL, Spotify creds). - Ensure FFmpeg is installed on the host.
- For process management, run the compiled
dist/index.jsunder your preferred supervisor (e.g., PM2 or systemd).
PolyForm Noncommercial 1.0.0 (LICENSE). Commercial use is not permitted.