The bot uses Lavalink for music streaming - a standalone audio server that handles YouTube, SoundCloud, and other sources without requiring cookies or authentication.
Lavalink provides:
- ✅ No cookies required - Works out of the box
- ✅ Stable streaming - Professional-grade audio server
- ✅ Multiple sources - YouTube, SoundCloud, Bandcamp, Twitch
- ✅ High performance - Optimized for Discord voice
- ✅ Easy scaling - Separate from bot process
The Lavalink server is already configured in docker-compose.yml and lavalink-config.yml. Default settings:
LAVALINK_HOST=127.0.0.1
LAVALINK_PORT=2333
LAVALINK_PASSWORD=youshallnotpassLavalink starts automatically with the bot:
docker compose up -dCheck Lavalink logs:
docker compose logs lavalinkYou should see:
Lavalink is ready to accept connections.
Try playing a song:
!play never gonna give you up
Edit .env to customize Lavalink connection:
LAVALINK_HOST=127.0.0.1 # Lavalink server host
LAVALINK_PORT=2333 # Lavalink server port
LAVALINK_PASSWORD=youshallnotpass # Change for production!Edit lavalink-config.yml to configure:
Enabled Sources:
sources:
youtube: true
soundcloud: true
bandcamp: true
twitch: true
vimeo: true
http: truePerformance Tuning:
bufferDurationMs: 400 # Audio buffer
youtubePlaylistLoadLimit: 6 # Max playlist size| Command | Description |
|---|---|
!play <song/url> |
Play a song or playlist |
!queue [page] |
Show the music queue |
!skip |
Skip current track |
!dj pause |
Pause playback |
!dj resume |
Resume playback |
!dj stop |
Stop and clear queue |
!dj volume <0-200> |
Adjust volume |
!dj loop <off/track/queue> |
Set loop mode |
!dj shuffle |
Shuffle queue |
!dj remove <position> |
Remove track from queue |
!dj clear |
Clear entire queue |
!dj disconnect |
Disconnect from voice |
!filters |
Apply audio filters |
Cause: Lavalink server is not running or not connected.
Solution:
-
Check if Lavalink container is running:
docker compose ps lavalink
-
Check Lavalink logs:
docker compose logs lavalink --tail=50
-
Restart Lavalink:
docker compose restart lavalink
Cause: YouTube search failed or query is invalid.
Solutions:
- Try a different search term
- Use a direct YouTube URL instead
- Check if YouTube is accessible from your server
Cause: Missing voice permissions or connection issues.
Solutions:
- Verify bot has
ConnectandSpeakpermissions - Check voice channel isn't full
- Restart bot:
docker compose restart bot
Cause: Network latency or buffer settings.
Solutions:
-
Increase buffer in
lavalink-config.yml:bufferDurationMs: 800
-
Check server network performance
-
Lower music volume:
!dj volume 80
Cause: Port conflict or configuration error.
Solutions:
-
Check if port 2333 is available:
lsof -i :2333
-
Verify
lavalink-config.ymlsyntax:docker compose config lavalink
-
Check logs for errors:
docker compose logs lavalink
To use an external Lavalink server, update .env:
LAVALINK_HOST=lavalink.example.com
LAVALINK_PORT=443
LAVALINK_PASSWORD=your-secure-passwordEdit Modules/LavalinkManager.js to add additional nodes:
nodes: [
{
host: "lavalink1.example.com",
port: 2333,
password: "password1",
},
{
host: "lavalink2.example.com",
port: 2333,
password: "password2",
},
]Edit lavalink-config.yml to control which sources are available:
sources:
youtube: true
soundcloud: false # Disable SoundCloud
bandcamp: true
twitch: false # Disable TwitchLavalink exposes metrics at http://localhost:2333/metrics
Configure Prometheus to scrape Lavalink metrics by adding to monitoring/prometheus/prometheus.yml:
scrape_configs:
- job_name: 'lavalink'
static_configs:
- targets: ['localhost:2333']Check Lavalink version and health:
curl http://localhost:2333/version| Feature | Lavalink | play-dl |
|---|---|---|
| Setup | Docker container | Requires cookies |
| Maintenance | Auto-updates | Manual cookie refresh |
| Stability | Very stable | Breaks frequently |
| Performance | Optimized | Good |
| Scalability | Excellent | Limited |
| Sources | Multiple | YouTube only |
| Authentication | None needed | Cookies required |
If you're migrating from the old play-dl system:
- ✅ Done: Lavalink is now installed
- ✅ Done: Commands are updated
- 🗑️ Cleanup: Remove old files (optional):
rm -f .youtube-cookies.json rm -rf Internals/Audio/AudioInit.js rm -rf Internals/Audio/AudioManager.js
If you encounter issues:
- Check logs:
docker compose logs bot lavalink - Verify permissions in Discord voice channels
- Test with a simple query:
!play test - Restart services:
docker compose restart bot lavalink