How to Contribute
Thank you for your interest in contributing to Rosy Music Bot! This guide will help you get started with development and submitting your changes.Contribution Types
We welcome contributions in several areas:- New Commands - Add new music or utility commands
- Bug Fixes - Fix issues and improve stability
- Feature Enhancements - Improve existing functionality
- Documentation - Improve code comments and docs
- Testing - Add tests and improve code coverage
- Performance - Optimize code and reduce resource usage
Getting Started
Prerequisites
Before you begin, ensure you have:- Node.js 16.9.0 or higher
- npm or yarn package manager
- Git installed
- A Discord bot token (Discord Developer Portal)
- (Optional) Spotify API credentials for Spotify integration
Development Setup
- Fork and clone the repository
- Install dependencies
- Configure environment variables
.env.example to .env and fill in your credentials:
.env:
- Create a development branch
- Start the bot
Project Structure Overview
Familiarize yourself with the codebase structure:Code Style Guidelines
General Principles
- Write clean, readable code - Code should be self-documenting
- Follow existing patterns - Maintain consistency with the codebase
- Comment complex logic - Explain the “why”, not the “what”
- Use descriptive names - Variables and functions should be self-explanatory
- Handle errors gracefully - Always catch and log errors properly
JavaScript Style
Indentation and Spacing- Use 4 spaces for indentation (not tabs)
- Add blank lines between logical sections
- Use single quotes for strings
Logging Standards
Use the Logger utility for all logging:Embed Standards
Always use the embed factory functions fromutils/embeds.js:
Adding New Commands
Command Template
Create a new file in/commands/music/yourcommand.js:
Command Best Practices
Always validate user permissions
Always validate user permissions
Provide clear error messages
Provide clear error messages
Use try-catch for async operations
Use try-catch for async operations
Log important actions
Log important actions
Testing Your Command
- Restart the bot - Commands are loaded on startup
- Test in Discord - Try the command:
r!yourcommand - Test edge cases:
- Without voice channel
- With invalid arguments
- During active playback
- Without active playback
- Check logs - Verify logging is working correctly
- Test error handling - Ensure errors are caught and displayed
Adding New Events
Event Template
Create a new file in/events/client/ or /events/distube/:
Available Event Types
Discord Client Events:messageCreate- New message sentinteractionCreate- Button/slash command interactionvoiceStateUpdate- User joins/leaves voice channelguildCreate- Bot joins new server
playSong- Song starts playingaddSong- Song added to queuefinish- Queue finishederror- Playback errordisconnect- Bot disconnects from voice
Testing Changes
Manual Testing Checklist
Before submitting changes, test the following:- Bot starts without errors
- Commands load successfully
- Events are registered
- Voice connection works
- Music playback functions correctly
- Error messages are user-friendly
- Logging is working
- No console errors during operation
Testing in a Development Server
- Create a test Discord server
- Invite your development bot
- Test all affected functionality
- Verify behavior with multiple users
- Test edge cases and error conditions
Debugging Tips
Enable detailed logging:Pull Request Process
Before Submitting
- Ensure your code follows style guidelines
- Test thoroughly - Verify all functionality works
- Update documentation - If adding features, update relevant docs
- Write clear commit messages - Follow conventional commits format
- Squash unnecessary commits - Keep history clean
Commit Message Format
Use conventional commits:Creating a Pull Request
- Push your branch to your fork
- Create PR on GitHub
- Go to the original repository
- Click “Pull Requests” > “New Pull Request”
- Select your fork and branch
- Fill in the PR template
- PR Description Template
- Respond to feedback
- Address review comments promptly
- Make requested changes
- Update PR description if scope changes
PR Review Process
Your PR will be reviewed for:- Code quality and style consistency
- Functionality and correctness
- Error handling and edge cases
- Documentation completeness
- Performance implications
Code of Conduct
Our Standards
- Be respectful - Treat all contributors with respect
- Be collaborative - Work together to improve the bot
- Be patient - Reviews and feedback take time
- Be constructive - Provide helpful, actionable feedback
- Be inclusive - Welcome contributors of all skill levels
Unacceptable Behavior
- Harassment or discriminatory comments
- Trolling or insulting remarks
- Personal or political attacks
- Publishing private information
- Other unprofessional conduct
Getting Help
If you need assistance:- Documentation - Check Project Structure and Architecture
- Issues - Search existing issues or create a new one
- Discord - Join our development Discord (link in README)
- Code Review - Ask questions in PR comments
Recognition
Contributors are recognized in:- GitHub contributors list
- CHANGELOG.md for significant contributions
- Bot credits command output