Overview
This guide provides recommendations for getting the most out of Rosy Music Bot while maintaining security, performance, and reliability.Bot Configuration
Environment Security
Securing Your Credentials
- Add
.envto.gitignore:
- Use environment-specific files:
- Rotate tokens regularly: Change your Discord bot token periodically
- Limit API key permissions: Only grant necessary permissions to API keys
Optimal Dependencies Configuration
Keep Dependencies Updated
After updating dependencies, remember to reapply the yt-dlp fix mentioned in the Troubleshooting guide.
Recommended Package Versions
The bot works best with:- Node.js: 18.17.0 or higher (LTS version recommended)
- Discord.js: 14.x
- Distube: 5.x
- @discordjs/voice: Latest version
Bot Presence Configuration
The bot’s presence is configured inconfig.js:
Managing Server Music Sessions
Queue Management Best Practices
Starting a Session
- Join voice channel first: Always be in the voice channel before commanding the bot
- Start with one song: Test playback before queuing multiple songs
- Use direct URLs for playlists: More reliable than searching
Managing Long Queues
- Check queue regularly: Use
r!queueto see what’s coming - Clear and restart: Use
r!stopto clear queue if it gets messy - One user manages: Designate one person to manage the queue in shared sessions
Session Lifecycle
Best Practices for Starting
Best Practices for Ending
Always use
r!stop to end sessions cleanly. This ensures the queue is cleared and resources are freed.Queue Management Tips
Efficient Queue Building
Use Direct URLs
- Faster processing
- No YouTube API quota usage
- Exact song you want
- Works with playlists
Search Optimization
Interactive Search Selection
When the bot shows multiple results:- Be ready: You have 20 seconds to select
- Read carefully: Check artist and duration before selecting
- Act quickly: Menu times out automatically
Volume Management
Performance Optimization
Server Performance
Resource Requirements
Minimum:- 512MB RAM
- 1 CPU core
- Stable internet connection
- 1GB+ RAM
- 2 CPU cores
- Low-latency internet
Monitoring Resources
Bot Performance
Optimize for Multiple Guilds
The bot handles multiple servers efficiently:- Each guild has independent queue
- Concurrent playback supported
- No cross-guild interference
The bot uses DisTube with
emitNewSongOnly: true to reduce event overhead and improve performance.Memory Management
The bot is configured with increased event listeners:Network Optimization
Reduce API Calls
- Use URLs: Direct links don’t use API quota
- Cache results: Reuse search results when possible
- Batch operations: Queue multiple songs at once
YouTube API Quota Management
YouTube API has daily quotas:- Default quota: 10,000 units/day
- Search cost: ~100 units per search
- Approximate searches: ~100/day
Security Considerations
Token Security
What to Never Share
- Discord bot token
- YouTube API key
- Spotify Client ID and Secret
.envfile contents- Database credentials (if added)
Safe Sharing Practices
- Use
.env.example: Template file without credentials - Document setup: Guide users to get their own keys
- Never screenshot: Don’t share screenshots with tokens visible
- Check commits: Review before pushing to ensure no tokens
Permission Principle
Required permissions:- Read Messages/View Channels
- Send Messages
- Embed Links
- Connect (voice)
- Speak (voice)
- Administrator
- Manage Server
- Manage Roles
- Manage Channels
API Key Restrictions
YouTube API Key
- Go to Google Cloud Console
- Select your project
- APIs & Services → Credentials
- Edit API key → Application restrictions:
- Set IP restrictions if hosting on static IP
- Set API restrictions to only YouTube Data API v3
Spotify API
- Go to Spotify Dashboard
- Edit Settings:
- Add redirect URIs if needed
- Don’t share Client Secret
Multi-Guild Best Practices
Scaling to Multiple Servers
The bot automatically handles multiple guilds:The bot can be in multiple servers simultaneously. Each server maintains:
- Separate music queue
- Independent volume settings
- Own playback state
Guild-Specific Considerations
Voice Regions
- Bot performs best in servers with nearby voice regions
- Higher latency in distant regions
- Consider hosting bot closer to primary servers
Concurrent Sessions
The bot can play music in multiple servers at once:- No limit on concurrent guilds (within Discord API limits)
- Each session independent
- Resources scale with active sessions
Load Balancing (Advanced)
For very large deployments:- Shard the bot: Discord.js supports sharding for 2500+ guilds
- Multiple instances: Run multiple bot instances with different tokens
- Queue system: Implement external queue management
Monitoring and Logging
The bot includes a custom logger:Log Management
- Monitor console: Watch for errors in real-time
- Log rotation: Implement log rotation for production
- Error tracking: Log errors for debugging
Deployment Best Practices
Development vs Production
Development Setup
Production Setup
Hosting Recommendations
Good hosting options:- VPS (DigitalOcean, Linode, Vultr)
- Cloud (AWS, Google Cloud, Azure)
- Dedicated server
- Heroku (dynos sleep, not ideal for voice)
- Shared hosting (limited resources)
- Replit (inconsistent for voice bots)
Uptime Monitoring
Backup and Recovery
What to Backup
- Source code: Keep in Git repository
- Configuration:
.env.exampletemplate - Custom modifications: Document all changes
What NOT to Backup
node_modules/(reinstall withnpm install).envwith actual credentials (security risk)- Log files (regenerate)
Maintenance Schedule
Weekly
- Check bot status and uptime
- Review error logs
- Test critical commands
Monthly
- Update dependencies:
npm update - Review API quota usage
- Check for Discord.js updates
- Reapply yt-dlp fix if updated
Quarterly
- Rotate bot token
- Review and update API keys
- Performance audit
- Update Node.js version
Common Pitfalls to Avoid
Related Resources
- Getting Started - Initial setup
- Troubleshooting - Fix common issues
- Commands Reference - All commands
- Inviting Bot - Add to servers