Prerequisites
Before installing Rosy Music Bot, ensure you have the following:Node.js
Version 18.17.0 or higher
Discord Bot Token
Create a bot at Discord Developer Portal
YouTube API Key
Get one from Google Cloud Console
Spotify API Credentials
Client ID and Secret from Spotify Dashboard
FFmpeg is included via the
ffmpeg-static dependency, but you can install it manually if needed.Installation
Install Dependencies
Install all required npm packages:This will install:
- discord.js v14.25.1
- distube v5.2.3
- @distube/spotify v2.0.2
- @distube/yt-dlp v2.0.1
- play-dl v1.9.7
- And other required dependencies
Configure Environment Variables
Create a
.env file in the root directory with your API credentials:.env
How to get Discord Bot Token
How to get Discord Bot Token
- Go to Discord Developer Portal
- Create a new application or select an existing one
- Navigate to the “Bot” section
- Copy the token (click “Reset Token” if needed)
- Enable “Message Content Intent” under Privileged Gateway Intents
How to get YouTube API Key
How to get YouTube API Key
- Go to Google Cloud Console
- Create a new project or select an existing one
- Enable the YouTube Data API v3
- Create credentials (API Key)
- Copy the API key
How to get Spotify API Credentials
How to get Spotify API Credentials
- Go to Spotify Developer Dashboard
- Create a new application
- Copy the Client ID
- Click “Show Client Secret” and copy it
Apply Critical Fix (Required)
After installing dependencies, you need to fix a known issue with yt-dlp:Open This parameter causes playback errors and must be disabled.
node_modules/@distube/yt-dlp/dist/index.js and find lines containing noCallHome: true (approximately lines 147 and 177).Comment them out:Start the Bot
Run the bot using npm:You should see output similar to:The bot will set its presence to “Listening to r!help 🎶”
Invite Bot to Your Server
Generate an invite link from the Discord Developer Portal:
- Go to your application in the Developer Portal
- Navigate to OAuth2 > URL Generator
- Select scopes:
bot,applications.commands - Select bot permissions:
- Read Messages/View Channels
- Send Messages
- Embed Links
- Connect
- Speak
- Copy the generated URL and open it to invite the bot
Your First Command
Once the bot is running and invited to your server:Play a Song
In any text channel, use the play command:The bot will:
- Search YouTube for “the scientist”
- Show you up to 5 results in a dropdown menu
- Wait for you to select a song (20 seconds)
- Join your voice channel and start playing
Example Usage
Troubleshooting
Bot doesn't play music (NO_RESULT error)
Bot doesn't play music (NO_RESULT error)
This is usually caused by the
noCallHome: true parameter in yt-dlp.Solution:- Navigate to
node_modules/@distube/yt-dlp/dist/index.js - Find lines with
noCallHome: true(around lines 147 and 177) - Comment them out:
// noCallHome: true, - Restart the bot with
npm start
FFmpeg errors
FFmpeg errors
If you encounter FFmpeg-related errors:Verify FFmpeg installation:Install manually if needed:Windows (using Chocolatey):Linux:macOS:
Bot doesn't respond to commands
Bot doesn't respond to commands
- Verify the prefix is
r!(configured inconfig.js) - Check that “Message Content Intent” is enabled in Discord Developer Portal
- Ensure the bot has proper permissions in the server
- Verify the TOKEN in
.envis correct
Permission errors
Permission errors
The bot needs these permissions:
- Read Messages/View Channels
- Send Messages
- Embed Links
- Connect (to voice channels)
- Speak (in voice channels)
The bot logs all activity to the console. Check the logs if you encounter issues.
Next Steps
Commands Reference
Learn about all available commands and their usage
Configuration
Customize the bot prefix, presence, and other settings
Architecture
Understand how the bot is built and structured
Troubleshooting
Detailed solutions for common issues