Contributing to Amiquin
Thank you for your interest in contributing to Amiquin! This guide will help you get started with contributing to the project.
Code of Conduct
By participating in this project, you agree to abide by our Code of Conduct:
- Be respectful to all community members
- Be constructive in discussions and feedback
- Be helpful to newcomers and fellow contributors
- Be patient with questions and different skill levels
Ways to Contribute
1. Reporting Bugs
Help us improve by reporting bugs you encounter:
- Check existing issues to avoid duplicates
- Use the bug report template when creating issues
- Provide detailed information:
- Steps to reproduce
- Expected vs actual behavior
- Environment details (OS, .NET version)
- Error messages or logs
2. Suggesting Features
We welcome feature suggestions:
- Check the roadmap for planned features
- Use the feature request template
- Explain the use case and benefits
- Consider implementation complexity
3. Contributing Code
Prerequisites
Before contributing code, ensure you have:
- .NET 9.0 SDK installed
- Git for version control
- Discord bot for testing
- Development environment set up (see Development Guide)
Getting Started
Fork the repository on GitHub
Clone your fork locally:
git clone https://github.com/YOUR_USERNAME/Amiquin.git cd Amiquin
Set up the development environment (see Development Guide)
Create a feature branch:
git checkout -b feature/your-feature-name
Making Changes
- Follow coding standards (see Code Style section)
- Write tests for new functionality
- Update documentation as needed
- Test your changes thoroughly
Submitting Changes
Commit your changes with descriptive messages:
git add . git commit -m "feat: add new command for user management"
Push to your fork:
git push origin feature/your-feature-name
Create a pull request with:
- Clear title and description
- Reference to related issues
- Screenshots if applicable
4. Documentation
Help improve our documentation:
- Fix typos and grammatical errors
- Add examples and clarifications
- Update outdated information
- Translate documentation to other languages
5. Testing
Contribute to test coverage:
- Write unit tests for existing code
- Add integration tests for new features
- Test edge cases and error scenarios
- Performance testing for optimization
Code Style Guidelines
General Principles
- Consistency: Follow existing code patterns
- Readability: Write self-documenting code
- Simplicity: Prefer simple, clear solutions
- Performance: Consider performance implications
C# Style Guidelines
Naming Conventions
// Classes: PascalCase
public class UserService { }
// Methods: PascalCase
public async Task GetUserAsync() { }
// Properties: PascalCase
public string UserName { get; set; }
// Fields: camelCase with underscore prefix for private
private readonly IUserRepository _userRepository;
// Constants: PascalCase
public const string DefaultPrefix = "!";
// Parameters and local variables: camelCase
public void ProcessUser(User user, string userName) { }
Code Organization
// Using statements at the top
using System;
using System.Threading.Tasks;
using Discord;
namespace Amiquin.Bot.Commands
{
// Class summary documentation
/// <summary>
/// Handles user-related commands and interactions.
/// </summary>
public class UserCommands : InteractionModuleBase<ExtendedShardedInteractionContext>
{
// Fields first
private readonly IUserService _userService;
// Constructor
public UserCommands(IUserService userService)
{
_userService = userService;
}
// Methods
[SlashCommand("profile", "View user profile")]
public async Task ProfileCommand(IUser user = null)
{
// Implementation
}
}
}
Formatting
- Use EditorConfig: The project includes
.editorconfig
for consistent formatting - Run formatter: Use
dotnet format
before committing - Indentation: 4 spaces (no tabs)
- Line length: Aim for 120 characters or less
- Braces: Opening brace on same line for methods, new line for classes
Commit Message Format
Use Conventional Commits format:
<type>[optional scope]: <description>
[optional body]
[optional footer(s)]
Types
- feat: New feature
- fix: Bug fix
- docs: Documentation changes
- style: Code style changes (formatting, etc.)
- refactor: Code refactoring
- test: Adding or updating tests
- chore: Build process or auxiliary tool changes
Examples
feat(commands): add user profile command
Add new slash command to display user profiles with statistics
and customizable display options.
Closes #123
fix(database): resolve connection timeout issues
Increase connection timeout and add retry logic for database
operations to handle temporary network issues.
Fixes #456
Pull Request Process
Before Submitting
- Ensure tests pass: Run
dotnet test
locally - Format code: Run
dotnet format
- Update documentation: Include relevant docs updates
- Test thoroughly: Test your changes in various scenarios
Pull Request Guidelines
- Clear title: Use descriptive title following conventional commits
- Detailed description: Explain what changes were made and why
- Link issues: Reference related issues using keywords (Fixes #123)
- Screenshots: Include screenshots for UI changes
- Breaking changes: Clearly mark any breaking changes
Review Process
- Automated checks: Ensure CI/CD passes
- Code review: Address reviewer feedback promptly
- Testing: Reviewers will test functionality
- Approval: At least one maintainer approval required
- Merge: Maintainers will merge approved PRs
Development Workflow
Branch Strategy
- main: Stable, production-ready code
- develop: Integration branch for features
- feature/: Feature development branches
- hotfix/: Critical bug fixes
- release/: Release preparation branches
Testing Strategy
Unit Tests
[Fact]
public async Task GetUserAsync_ValidId_ReturnsUser()
{
// Arrange
var userId = 123456789;
var expectedUser = new User { DiscordId = userId };
_mockRepository.Setup(r => r.GetUserAsync(userId))
.ReturnsAsync(expectedUser);
// Act
var result = await _userService.GetUserAsync(userId);
// Assert
Assert.Equal(expectedUser, result);
}
Integration Tests
Test complete workflows including database interactions and external services.
Documentation Updates
When contributing, update relevant documentation:
- Code comments: Add XML documentation for public APIs
- README files: Update setup and usage instructions
- API docs: Update DocFX documentation
- Change logs: Add entries for significant changes
Getting Help
Resources
- Documentation: Check existing docs first
- Issues: Search existing issues for similar problems
- Discussions: Use GitHub Discussions for questions
- Discord: Join our development Discord server
Asking Questions
When asking for help:
- Search first: Check if the question was already answered
- Be specific: Provide context and details
- Include code: Share relevant code snippets
- Describe attempts: What have you already tried?
Mentoring
New contributors can get help from experienced developers:
- Good first issues: Look for issues labeled "good first issue"
- Pair programming: Request help with complex features
- Code reviews: Learn from feedback on your PRs
Recognition
We appreciate all contributions! Contributors are recognized through:
- Contributors section in README
- Release notes mention significant contributions
- Discord roles for active contributors
- Maintainer status for long-term contributors
License
By contributing to Amiquin, you agree that your contributions will be licensed under the MIT License.
Thank you for contributing to Amiquin! 🤖