A comprehensive Discord bot designed to elevate user experience within servers by providing interactive music playback functionalities. This bot empowers communities, gaming groups, and individuals to create a shared musical experience on Discord, fostering engagement and creating a more enjoyable atmosphere.
- 🎯 Music Playback: Play music from various sources like YouTube, SoundCloud, and Spotify, providing controls for play, pause, skip, stop, and volume adjustments.
- 🛠️ Search Functionality: Easily find and play specific songs or playlists with a user-friendly search command that suggests relevant results.
- 🚀 Voice Channel Management: Seamlessly join and leave voice channels based on user commands, allowing users to control bot volume and adjust audio settings.
- Node.js (v16 or later)
- npm (or yarn)
- Docker (optional)
- Clone the repository:
git clone https://github.com/spectra-ai-codegen/discord-music-bot.git
- Navigate to the project directory:
cd discord-music-bot
- Install dependencies:
npm install
- Set up environment variables:
- Create a
.env
file in the project root. - Add your Discord bot token, Lavalink server URL, and other API keys as environment variables:
DISCORD_TOKEN=your_discord_bot_token LAVALINK_URL=your_lavalink_server_url YOUTUBE_API_KEY=your_youtube_api_key SOUNDCLOUD_CLIENT_ID=your_soundcloud_client_id SPOTIFY_CLIENT_ID=your_spotify_client_id SPOTIFY_CLIENT_SECRET=your_spotify_client_secret GENIUS_ACCESS_TOKEN=your_genius_access_token MUSIXMATCH_API_KEY=your_musixmatch_api_key
- Create a
- Start the development server:
npm start
- Invite the bot to your Discord server:
- Go to https://discord.com/api/oauth2/authorize?client_id=YOUR_BOT_ID&permissions=8&scope=bot (replace
YOUR_BOT_ID
with your bot's ID). - Select your server and authorize the bot.
- Go to https://discord.com/api/oauth2/authorize?client_id=YOUR_BOT_ID&permissions=8&scope=bot (replace
Adjust configuration settings in config.js
.
- 📝 Play a song:
!play <song name>
- 📝 Search for a song:
!search <song name>
- 📝 Add a song to the queue:
!queue <song name>
- 📝 Skip the current song:
!skip
- 📝 Pause the music:
!pause
- 📝 Resume playback:
!resume
- 📝 Stop the music:
!stop
- 📝 Set the volume:
!volume <number>
- 📝 Display the current song:
!nowplaying
- 📝 Create a playlist:
!createplaylist <playlist name>
- 📝 Add a song to a playlist:
!addplaylist <playlist name> <song name>
- 📝 Remove a song from a playlist:
!removeplaylist <playlist name> <song name>
- 📝 List the songs in a playlist:
!listplaylist <playlist name>
- 📝 Play a playlist:
!playplaylist <playlist name>
- Install the Heroku CLI:
npm install -g heroku
- Login to Heroku:
heroku login
- Create a new Heroku app:
heroku create
- Deploy the code:
git push heroku main
- Set environment variables:
- Go to your Heroku app's settings page.
- Add the environment variables listed in the
.env
section.
DISCORD_TOKEN
: Your Discord bot token.LAVALINK_URL
: Your Lavalink server URL.YOUTUBE_API_KEY
: Your YouTube Data API v3 key.SOUNDCLOUD_CLIENT_ID
: Your SoundCloud client ID.SPOTIFY_CLIENT_ID
: Your Spotify client ID.SPOTIFY_CLIENT_SECRET
: Your Spotify client secret.GENIUS_ACCESS_TOKEN
: Your Genius API access token.MUSIXMATCH_API_KEY
: Your Musixmatch API key.MONGODB_URI
: Your MongoDB connection URI (optional, for storing playlists).
(Optional: If you are adding a web interface, provide documentation for the APIs you expose.)
- GET /api/playlists: Retrieves a list of playlists (if using MongoDB).
- POST /api/playlists: Creates a new playlist (if using MongoDB).
(Optional: If using authentication, describe your authentication mechanism.)
(Optional: Provide example API requests.)
This project is licensed under the GNU AGPLv3.
- Author Name - Spectra.codes
- Contributor Name - DRIX10
Special thanks to: