The Audio System uses play-dl to stream music from YouTube. YouTube requires authentication cookies to work properly.
You need to extract your YouTube cookies to use the music system. Follow these steps:
-
Install a cookie export extension:
- Chrome: EditThisCookie
- Firefox: cookies.txt
-
Go to YouTube
-
Make sure you're logged in to your YouTube account
-
Export cookies for
youtube.com -
Save the exported cookies
- Open YouTube in your browser
- Press
F12to open Developer Tools - Go to the "Application" or "Storage" tab
- Find "Cookies" → "https://www.youtube.com"
- Copy all cookie values
Create a file named .youtube-cookies.json in the bot's root directory:
{
"cookie": "PASTE_YOUR_COOKIES_HERE"
}Example format:
{
"cookie": "VISITOR_INFO1_LIVE=xyz123; PREF=f1=50000000; YSC=abc456; ..."
}After creating the cookie file, restart the bot. You should see:
[INFO] YouTube cookies loaded for play-dl
[INFO] Audio System initialized!
This warning appears if the .youtube-cookies.json file is not found. Create the file as described above.
- Check cookies are valid: YouTube cookies expire periodically. Re-export and update your
.youtube-cookies.json - Check logs: Look for "Search error" messages in the logs
- Verify YouTube access: Make sure the account used for cookies can access YouTube normally
- Ensure the bot has
ConnectandSpeakpermissions in voice channels - Check that @discordjs/voice and ffmpeg-static are installed
- Verify voice channel is not full
The bot uses high-quality audio (quality: 2) by default. If you experience issues, this can be adjusted in Internals/Audio/AudioManager.js.
Important: Keep your .youtube-cookies.json file secure:
- Add it to
.gitignore(already done) - Never commit it to version control
- Never share it publicly
- Cookies contain authentication data for your YouTube account
Cookies can be refreshed without restarting:
// In bot console or maintainer panel
const AudioInit = require('./Internals/Audio/AudioInit');
await AudioInit.refreshCookies();Simply replace the cookies in .youtube-cookies.json with cookies from a different YouTube account.
For more information about play-dl cookie setup: