Welcome to the Discord Music Bot repository! This bot is a powerful, feature-rich music bot built with Python and discord.py
, offering seamless integration with YouTube and Spotify. This project was created with the assistance of ChatGPT to demonstrate the capabilities of AI-driven development.
- Features
- Commands
- Installation
- Getting Spotify Credentials
- Getting Genius API Key
- Discord Bot Permissions
- Contributing
- License
- Acknowledgements
- Planned Features
- YouTube Playback: Play your favorite tracks directly from YouTube.
- Spotify Integration: Add songs from Spotify and enjoy high-quality music.
- Queue Management: Add, skip, pause, resume, and stop songs with ease.
- Interactive Slash Commands: Utilize modern slash commands for an enhanced user experience.
- Multilingual Help: Get help in multiple languages.
- Lyrics Fetching: Fetch lyrics for the currently playing song.
Command | Description |
---|---|
/join |
Join the voice channel. |
/leave |
Leave the voice channel. |
/play <URL> |
Play a YouTube or Spotify video. |
/pause |
Pause the playback. |
/resume |
Resume the playback. |
/skip |
Skip the current song. |
/stop |
Stop the playback. |
/lyrics |
Fetch the lyrics for the current song. |
/help |
Show help information. |
You have two options to set up the Discord Music Bot: cloning the repository or using the provided setup installer.
-
Clone the repository:
git clone https://github.com/MCbabel/discord-music-bot.git cd discord-music-bot
-
Install the required dependencies:
pip install -r requirements.txt
-
Set up your environment variables:
Create a
.env
file in the root directory and add your Discord token and Spotify credentials:DISCORD_TOKEN=your_discord_token SPOTIFY_CLIENT_ID=your_spotify_client_id SPOTIFY_CLIENT_SECRET=your_spotify_client_secret GENIUS_API_KEY=your_genius_api_key
-
Run the bot:
python bot.py
-
Download the setup file:
-
Run the setup file:
Double-click on the
setup.bat
file and follow the prompts to enter your Discord Bot Token, Spotify Client ID, and Spotify Client Secret. This will automatically set up your environment variables and install the required dependencies. -
Run the bot:
Once the setup is complete, simply run the
bot.py
file to start the bot.python bot.py
To integrate Spotify, you need to obtain a Client ID and Client Secret from the Spotify Developer Dashboard. Here are the steps:
-
Create a Spotify Developer Account:
- Go to the Spotify Developer Dashboard.
- Log in with your Spotify account or create a new account.
-
Create an App:
- Click on "Create an App".
- Fill in the required details like App name and description.
- Select “Which API/SDKs do you plan to use?” Web API.
- Agree to the terms and conditions and click "Create".
-
Retrieve Your Credentials:
- Once your app is created, you will be redirected to the app dashboard.
- Here, you can find your Client ID and Client Secret. Copy these values.
-
Add Redirect URI:
- Click on "Edit Settings" in your app dashboard.
- Under "Redirect URIs", add
http://localhost:8888/callback
and save.
-
Add Credentials to .env File:
- Update your
.env
file with the obtained credentials.
DISCORD_TOKEN=your_discord_token SPOTIFY_CLIENT_ID=your_spotify_client_id SPOTIFY_CLIENT_SECRET=your_spotify_client_secret
- Update your
To fetch lyrics, you need to obtain a Genius API Key. Here are the steps:
-
Create a Genius Account:
- Go to the Genius API page.
- Log in with your Genius account or create a new account.
-
Create an API Client:
- Click on "Create an API Client".
- Fill in the required details like App name and description.
- Agree to the terms and conditions and click "Save".
-
Retrieve Your API Key:
- Once your app is created, you will be redirected to the app dashboard.
- Here, you can find your API Key. Copy this value.
-
Add API Key to .env File:
- Update your
.env
file with the obtained API Key.
DISCORD_TOKEN=your_discord_token SPOTIFY_CLIENT_ID=your_spotify_client_id SPOTIFY_CLIENT_SECRET=your_spotify_client_secret GENIUS_API_KEY=your_genius_api_key
- Update your
To ensure that your bot works correctly, you need to invite it to your server with the necessary permissions. Use the following OAuth2 URL to generate an invite link for your bot:
Replace YOUR_CLIENT_ID
with your bot's client ID.
View Channels
: Allows the bot to see text channels and read messages.Send Messages
: Allows the bot to send messages in text channels.Connect
: Allows the bot to connect to voice channels.Speak
: Allows the bot to play audio in voice channels.Use Slash Commands
: Allows the bot to register and use slash commands.
Contributions are welcome! Please fork this repository and submit a pull request for any changes you would like to make.
See the LICENSE file for details.
This project was created with the assistance of ChatGPT, demonstrating the power of AI in software development. Special thanks to the OpenAI team for providing such an incredible tool.
- Lyrics fetching using Genius API
- Music playback controls via reactions
- Custom playlists
- Voting to skip songs
- Auto-disconnect after inactivity
- Volume control
- Now playing message with song progress
- Integration with more streaming services
- User-specific playlists
- Song search functionality
- Customizable bot settings
Happy listening! 🎵