discord-music-bot

Discord music bot template written in NodeJS using discord.js and erela.js, with Lavalink support.

Features

  • Slash commands: /ping, /join, /play, /leave
  • Lavalink integration for audio playback
  • Modular command handler structure

Prerequisites

  • Node.js (>=14)
  • pnpm or npm
  • A Discord application with bot token
  • LavaLink server for audio streaming

Setup

  1. Copy .env.example to .env and fill in your credentials:
    DISCORD_TOKEN=your_discord_bot_token
    CLIENT_ID=your_discord_application_id
    LAVALINK_HOST=127.0.0.1
    LAVALINK_PORT=2333
    LAVALINK_PASSWORD=your_lavalink_password
    
  2. Install dependencies:
    pnpm install
    
  3. Run tests:
    pnpm test
    
  4. Register slash commands:
    pnpm start # or node deploy-commands.js
    
  5. Start the bot:
    pnpm start
    

Docker

A Dockerfile and docker-compose.yml are provided for containerized deployment.

  • Build and run with Docker Compose:
    docker-compose up --build
    
  • Environment variables are loaded from .env.
  • Lavalink service is configured in docker-compose.yml alongside the bot.

Project Structure

  • src/index.js — Entry point
  • src/commands/ — Slash command modules
  • src/events/ — Discord event handlers
  • src/structures/ — Erela.js (Lavalink) event wiring
  • src/utils/logger.js — Logging setup
  • deploy-commands.js — Slash command registration script
  • Dockerfile — Bot container image
  • docker-compose.yml — Multi-service setup (bot + Lavalink)

License

MIT

Description
Discord bot made in Rust using serenity and lavalink-rs
Readme GPL-3.0 3.2 MiB
Languages
TypeScript 89.2%
JavaScript 5.8%
Shell 2.9%
Dockerfile 2.1%