MyDJ26 - Modern Discord music bot with YouTube and Spotify support, featuring YouTube bot protection bypass and container optimization.
- ๐ Invidious Backup System - Automatically switches to alternative YouTube frontends when main YouTube fails
- ๐ค Multi-Client Strategy - Tries Android, Web, and Basic clients for maximum compatibility
- ๐ User-Agent Rotation - Uses different browser identities to avoid detection
- ๐ณ Container Optimization - Specially optimized for Railway/Docker cloud deployment
- โ Removed Hardcoded Tokens - All sensitive data now uses environment variables
- ๐ International Code Standards - Comments and documentation converted to English
- ๐ ๏ธ Enhanced Error Handling - Specific solutions for each error type
- ๐ Professional Documentation - Comprehensive README with troubleshooting guides
- International Interface - Full English interface with Turkish command aliases
- ๐ Advanced Status Command - Detailed bot statistics with
+status - โ Comprehensive Help System - Complete command guide with
+commands - ๐ Smart Fallback System - Automatically tries next method when one fails
- ๐น๐ท Turkish Command Support - Turkish aliases for all commands (e.g.,
+calfor+play)
- ๐ Enhanced Lyrics System - Integration with lyrics.ovh API
- โญ๏ธ Smart Queue Management - Continues to next song on errors
- ๐ถ Multiple Format Support - M4A, WebM, MP4 compatibility
- ๐ Improved Audio Quality - Better audio extraction strategies
๐ Ready for Production: This update makes the bot significantly more reliable against YouTube restrictions and ready for cloud deployment!
- ๐ต YouTube and Spotify support - Play using links or search by song name
- ๐ถ Smart queue system - Sequential playback and advanced queue management
- โฏ๏ธ Full playback control - Pause, resume, skip, stop commands
- ๐ Queue shuffling - Random playback feature
- ๐ Song lyrics - Real-time lyrics fetching from lyrics.ovh API
- ๐งน Message cleanup - Channel management commands
- ๐ Auto voice channel management - Smart connection and switching
- ๐ Invidious Backup System - Alternative servers when YouTube fails
- ๐ค Multi-Client Strategy - Android, Web, and Basic client attempts
- ๐ User-Agent Rotation - Different browser identities
- ๐ณ Container Optimization - Specially optimized for Railway/Docker
- ๐น๐ท Turkish Interface - Full Turkish user interface support
- ๐ Bot Status - Detailed bot statistics with
+statuscommand - โ Help System - Comprehensive help menu with
+komutlar - ๐ก๏ธ Smart Error Handling - Each error type has specific solution suggestions
- ๐ Automatic Fallback - If one method fails, try the next
- โญ๏ธ Queue Management - Continue to next song on error
- Python 3.8 or higher
- FFmpeg (for audio processing)
- Discord Bot Token (Discord Developer Portal)
-
Clone the repository:
git clone https://github.com/yourusername/MyDJ26.git cd MyDJ26 -
Install required packages:
pip install -r requirements.txt
-
Create environment file:
cp env.example .env
-
Add your Discord Bot Token:
- Open the
.envfile - Replace
your_discord_bot_token_herewith your actual token
DISCORD_BOT_TOKEN=YOUR_ACTUAL_TOKEN_HERE - Open the
-
Run the bot:
python music_bot.py
| Command | Aliases | Description |
|---|---|---|
+play <song/link> |
+p, +cal, +oynat |
Plays YouTube/Spotify links or searches by song name |
+queue |
+q, +kuyruk |
Shows the music queue |
+skip |
+s, +atla |
Skips the current song |
+shuffle |
+karistir |
Shuffles the queue |
+pause |
+dur |
Pauses the music |
+resume |
+devam |
Resumes the music |
+stop |
+durdur |
Stops music and clears queue |
+disconnect |
+leave, +dc, +ayril |
Disconnects from voice channel |
| Command | Aliases | Description |
|---|---|---|
+lyrics [song] |
+lyric, +sozler |
Gets song lyrics (leave empty for current song) |
+status |
+durum |
Shows bot status and statistics |
+commands |
+help, +komutlar, +yardim |
Shows command list and help |
+clear [number] |
+c, +clean, +temizle |
Deletes specified number of messages (default: 10) |
# Play YouTube video (English/Turkish)
+play https://www.youtube.com/watch?v=dQw4w9WgXcQ
+cal https://www.youtube.com/watch?v=dQw4w9WgXcQ
# Play Spotify song
+play https://open.spotify.com/track/4iV5W9uYEdYUVa79Axb7Rh
# Search by song name (English/Turkish)
+play imagine dragons believer
+oynat imagine dragons believer
# Queue control (English/Turkish)
+queue / +kuyruk
+skip / +atla
+shuffle / +karistir
# Music control (English/Turkish)
+pause / +dur
+resume / +devam
+stop / +durdur
# Song lyrics (English/Turkish)
+lyrics bohemian rhapsody / +sozler bohemian rhapsody
+lyrics # (lyrics for currently playing song)
# Bot status and help (English/Turkish)
+status / +durum
+commands / +komutlarThis bot includes several strategies to handle YouTube's bot detection:
- Invidious Instances - Uses alternative YouTube frontends
- Multiple Extraction Strategies - Tries different clients (Android, Web)
- Format Flexibility - Supports M4A, WebM, MP4 formats
- Container Environment - Optimized for Docker/Railway deployment
https://invidious.fdn.frhttps://invidious.privacydev.nethttps://invidious.lunar.icuhttps://iv.melmac.spacehttps://invidious.slipfox.xyz
# Build Docker image
docker build -t mydj26 .
# Run container (requires .env file)
docker run --env-file .env mydj26Railway is a modern cloud platform that makes deployment simple and fast.
-
Create a Railway account:
- Go to Railway.app
- Sign up with GitHub
-
Deploy from GitHub:
- Go to Railway Dashboard
- Click "New Project"
- Select "Deploy from GitHub repo"
- Choose your repository
- Railway will automatically detect it's a Python project
-
Add Environment Variables:
- In your Railway project dashboard
- Go to "Variables" tab
- Add:
DISCORD_BOT_TOKEN=your_actual_token_here
-
Deploy:
- Railway will automatically build and deploy your bot
- Your bot will be live in seconds!
- โ Automatic deploys - Pushes to main branch auto-deploy
- โ Free tier - Great for small bots
- โ Easy scaling - Upgrade when needed
- โ Built-in monitoring - Logs and metrics included
- Go to Discord Developer Portal
- Click "New Application"
- Give your application a name
- Go to the "Bot" tab
- Click "Add Bot"
- Copy the token from the "Token" section
- Enable "Message Content Intent" under "Privileged Gateway Intents"
When adding the bot to your server, it needs these permissions:
- โ Send Messages
- โ Connect (to voice channels)
- โ Speak (in voice channels)
- โ Use Voice Activity
- โ Manage Messages (for clear command)
"DISCORD_BOT_TOKEN environment variable not found!"
- Make sure the
.envfile is created correctly - Verify the token is copied correctly without quotes
"YouTube bot protection is active!"
- Wait 5-10 minutes and try again
- Use shorter and simpler song names
- Try using VPN from different location
- The bot will automatically try Invidious instances
"Cannot connect to voice channel"
- Check bot's voice channel permissions
- Make sure FFmpeg is installed correctly
- Try different voice channel
- Check server voice region settings
"All extraction strategies failed"
- 3 different client strategies were attempted
- Invidious backup system also failed
- Wait 10-15 minutes and try again
- YouTube may be experiencing heavy restrictions
MyDJ26/
โโโ music_bot.py # Main bot file
โโโ requirements.txt # Python dependencies
โโโ env.example # Example environment file
โโโ .gitignore # Git ignore rules
โโโ Dockerfile # Docker container definition
โโโ Procfile # Railway deployment
โโโ README.md # This file
- Fork this repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- discord.py - Discord API wrapper
- yt-dlp - YouTube downloader
- Invidious - Alternative YouTube frontend
- lyrics.ovh - Lyrics API service
- ๐ต Multi-format support: M4A, WebM, MP4
- ๐ 5 Invidious instances for reliability
- ๐ค 3 extraction strategies for YouTube
- ๐น๐ท Full Turkish interface support
- ๐ณ Container optimized for cloud deployment