PakoDJ is a Discord bot written in Python that lets you play music directly in your server's voice channels. With its features, you can search for songs on YouTube, manage music queues, view playback history, and much more!
- Music Playback: Search and play songs from YouTube via links or keywords.
- Spotify Integration: Play music from Spotify URLs (tracks, albums, playlists) by searching on YouTube.
- SoundCloud Support: Play music directly from SoundCloud URLs with enhanced HLS streaming support.
- Queue Management: Add songs to the queue and play them in sequence.
- Playback Controls: Pause, resume, or skip tracks.
- History: View previously played tracks.
- Voice Integration: Automatically connects to the voice channel you're in.
- Multi-Server Support: Each server has its own queue and playback history.
- Docker and Docker Compose installed
- A Discord bot token (you can obtain one from the Discord Developer Portal)
- Python 3.8 or higher installed
- ffmpeg installed
- A Discord bot token (you can obtain one from the Discord Developer Portal)
- Optional: Spotify API credentials for Spotify URL support (get them from Spotify Developer Dashboard)
- The following Python libraries installed:
discord.pyyt-dlppython-dotenvPyNaClspotipy
- Clone the repository:
git clone https://github.com/Pako3549/PakoDJ.git cd PakoDJ - Configure the
.envfile: Create a.envfile in thebot/directory:token=YOUR_BOT_TOKEN # Optional: For Spotify URL support SPOTIFY_CLIENT_ID=YOUR_SPOTIFY_CLIENT_ID SPOTIFY_CLIENT_SECRET=YOUR_SPOTIFY_CLIENT_SECRET
- Run the bot:
docker-compose up -d
If you prefer to build the image yourself:
docker-compose -f docker-compose.build.yml up -d- Clone the repository:
git clone https://github.com/Pako3549/PakoDJ.git cd PakoDJ - Install the dependencies:
pip install -r bot/requirements.txt
- Configure the
.envfile: Create a.envfile in thebot/directory and add your bot token:token=YOUR_BOT_TOKEN # Optional: For Spotify URL support SPOTIFY_CLIENT_ID=YOUR_SPOTIFY_CLIENT_ID SPOTIFY_CLIENT_SECRET=YOUR_SPOTIFY_CLIENT_SECRET
- Run the bot:
python bot/main.py
- View logs:
docker-compose logs -f pakodj - Stop the bot:
docker-compose down - Restart the bot:
docker-compose restart pakodj - Update image:
docker-compose pull && docker-compose up -d
- View logs:
docker-compose -f docker-compose.build.yml logs -f pakodj - Stop the bot:
docker-compose -f docker-compose.build.yml down - Restart and rebuild:
docker-compose -f docker-compose.build.yml up -d --build
If you want to play age-restricted (+18) YouTube videos, you must provide your YouTube cookies to yt-dlp.
Please follow the official yt-dlp guides:
After extracting your cookies, save them in a text file named youtube_cookies.txt in the bot/ directory.
The Docker container will automatically mount this file and make it available to the bot.
After extracting your cookies, save them in a text file named youtube_cookies.txt in the same directory as the script that starts the bot (bot/main.py).
This is required only for playing age-restricted content; for normal videos, no cookies are needed.
PakoDJ supports playing music from Spotify URLs! When you provide a Spotify track, album, or playlist URL, the bot will:
- Extract the track information from Spotify
- Search for the track on YouTube
- Play the audio from YouTube (avoiding DRM restrictions)
- Go to Spotify Developer Dashboard
- Create a new app (or use an existing one)
- Copy your Client ID and Client Secret
- Add them to your
.envfile:SPOTIFY_CLIENT_ID=your_client_id_here SPOTIFY_CLIENT_SECRET=your_client_secret_here
Note: Spotify integration is optional. The bot works perfectly fine without it, but you won't be able to use Spotify URLs.
- Tracks:
https://open.spotify.com/track/... - Albums:
https://open.spotify.com/album/...(plays first track) - Playlists:
https://open.spotify.com/playlist/...(plays first track)
PakoDJ also supports playing music directly from SoundCloud! The bot automatically detects SoundCloud URLs and uses enhanced streaming technology to handle HLS audio formats.
- Tracks:
https://soundcloud.com/artist/track-name - Short URLs:
https://snd.sc/... - Mobile URLs:
https://m.soundcloud.com/...
Note: SoundCloud support works out of the box - no additional configuration needed! The bot automatically optimizes FFmpeg settings for SoundCloud's HLS streaming format.
| Command | Description |
|---|---|
!play <query> |
Plays a song searched using keywords, YouTube links, Spotify URLs, or SoundCloud URLs. If a song is already playing, adds it to the queue. |
!repeat <n> <query> |
Plays a song in loop for n times. Supports YouTube, Spotify, and SoundCloud URLs (use !skip all to stop the loop). |
!skip |
Skips the current track and plays the next one in the queue. |
!skip all |
Skips the current track and the loop; then it plays the next track in queue. |
!pause |
Pauses the currently playing track. |
!resume |
Resumes the paused track. |
!track |
Shows the currently playing track. |
!queue |
Displays the queue of tracks. |
!history |
Shows the history of previously played tracks. |
!stop |
Stops playback and disconnects the bot from the voice channel. |
!djhelp |
Displays the list of available commands. |
- Search and Playback: The bot uses
yt-dlpto fetch the best available audio from YouTube. - Spotify Integration: When a Spotify URL is provided, the bot extracts track information and searches for it on YouTube.
- SoundCloud Support: Direct streaming from SoundCloud with optimized FFmpeg settings for HLS audio formats.
- Dynamic Management: Each server has its own queue and playback history.
- Automatic Connection: The bot automatically connects to the voice channel of the user issuing a command.
- Error:
Bot is not in a voice channel
Ensure the bot is connected to a voice channel and that you're in the same channel. - Error during playback
Check if the link or query is valid. For persistent issues, check the console for detailed error messages.
This project is open-source and available under the GPL-3.0 License. See the LICENSE file for more details.