This project aims to create a powerful and versatile Discord music bot that enhances the social experience within Discord servers by providing a seamless and enjoyable music listening experience. The bot will offer a user-friendly interface with a wide range of features, allowing users to search, select, and play music from various platforms directly within Discord.
Key Features:
- Music Playback: Play music in Discord voice channels with controls like play, pause, stop, skip, and repeat.
- Search and Selection: Search for music using keywords or links, browse results, and add songs to the queue.
- Playlist Creation: Create and manage playlists, organizing songs into themed collections.
- Voice Channel Integration: Seamlessly join and leave voice channels based on user commands.
- User Interface: Intuitive commands with clear syntax and informative messages.
- Enhancements: Advanced search, lyrics display, customizable settings, radio mode, and third-party integrations.
- Node.js (v18 or later)
- npm (comes bundled with Node.js)
- Git
- Docker (for optional containerization)
- 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
- Create a
.env
file:cp .env.example .env
- Configure environment variables:
- Replace the placeholder values in the
.env
file with your actual Discord bot token, API keys, and any other required credentials.
- Replace the placeholder values in the
- Start the development server:
npm start
- Invite the bot to your Discord server:
- Visit the bot's application page on the Discord Developer Portal (https://discord.com/developers/applications).
- Navigate to the "OAuth2" tab.
- Select the "bot" scope and the necessary permissions (e.g., "Connect" and "Speak" for voice channels, "Manage Channels" for joining/leaving channels).
- Generate an invite link and use it to add the bot to your server.
- Command Prefix:
- The bot's default command prefix is defined in
src/config.json
. - You can change this prefix to suit your preferences.
- The bot's default command prefix is defined in
- Music Sources:
- You can configure the bot to use specific music sources (e.g., YouTube, Spotify, SoundCloud) in
src/config.json
.
- You can configure the bot to use specific music sources (e.g., YouTube, Spotify, SoundCloud) in
- Other settings:
- You can customize other bot settings, such as the default volume, song limit, and allowed music sources in
src/config.json
.
- You can customize other bot settings, such as the default volume, song limit, and allowed music sources in
/play [search query or URL]
: Plays a song from YouTube, Spotify, or SoundCloud./pause
: Pauses the currently playing song./resume
: Resumes playback of the paused song./stop
: Stops playback and clears the queue./skip
: Skips to the next song in the queue./queue
: Displays the current music queue./nowplaying
: Shows the currently playing song./loop
: Toggles loop mode for the queue./clear
: Clears the music queue.
/help
: Displays a list of available commands and their descriptions./ping
: Checks the bot's latency.
- 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
DISCORD_TOKEN
: Your Discord bot token (required).SPOTIFY_CLIENT_ID
: Your Spotify client ID (required if using Spotify).SPOTIFY_CLIENT_SECRET
: Your Spotify client secret (required if using Spotify).SOUNDCLOUD_CLIENT_ID
: Your SoundCloud client ID (required if using SoundCloud).SOUNDCLOUD_CLIENT_SECRET
: Your SoundCloud client secret (required if using SoundCloud).
/api/v1/search
: Searches for music across YouTube, Spotify, and SoundCloud.- Parameters:
q
: The search query.source
: The music source (e.g.,youtube
,spotify
,soundcloud
).
- Response:
- A list of search results.
- Parameters:
- The API does not require authentication for general search functionality.
- However, for specific actions like adding or managing playlists, authentication using JWT tokens might be implemented in the future.
# Search for a song on YouTube
curl -X GET http://localhost:3000/api/v1/search?q=Imagine+Dragons&source=youtube
# Search for an artist on Spotify
curl -X GET http://localhost:3000/api/v1/search?q=Billie+Eilish&source=spotify
This project is licensed under the GNU AGPLv3.
- Spectra.codes - Initial project development.
- DRIX10 - Contributions to project development.