Welcome Contributors
Thank you for considering contributing to Aphonos! This bot serves the ALTER EGO Wiki and Tower Defense Simulator Wiki communities, and we welcome improvements, bug fixes, and new features.Getting Started
Prerequisites
- Node.js (v18 or higher recommended)
- npm or yarn package manager
- A Discord bot token (for testing)
- Basic knowledge of TypeScript and Discord.js
Development Setup
Configure Environment
Development Workflow
Building the Project
Compile TypeScript to JavaScript:dist/ directory and copies necessary image assets.
Running in Production Mode
After building:Code Formatting
Format code with Prettier:Code Style Guidelines
TypeScript Standards
- Use TypeScript’s strict mode (enabled by default)
- Define proper types for all function parameters and return values
- Use interfaces for complex object structures
- Avoid
anytype unless absolutely necessary
Naming Conventions
- Files: Use camelCase for command files (e.g.,
battlestats.ts,reactionrole.ts) - Classes: Use PascalCase (e.g.,
AltershaperBot,LockManager) - Functions: Use camelCase (e.g.,
handleInteraction,loadCommands) - Constants: Use SCREAMING_SNAKE_CASE (e.g.,
WELCOME_CHANNEL_ID)
Discord.js Best Practices
- Always use
MessageFlags.Ephemeralfor error messages - Handle both replied and deferred interactions in error handlers
- Use embeds for rich, formatted responses
- Check for null/undefined before accessing guild members or channels
Error Handling
All command execute functions should include try-catch blocks:Making Changes
Creating a New Branch
Create a descriptive branch name:Commit Messages
Use clear, descriptive commit messages:- Good: “Add /poll command for creating server polls”
- Good: “Fix battle lock not releasing after timeout”
- Bad: “Update files”
- Bad: “Changes”
- Start with a verb (Add, Fix, Update, Remove, Refactor)
- Be specific about what changed
- Keep it concise but descriptive
Testing Your Changes
Testing Commands
Testing Commands
- Create a test Discord server
- Invite your bot with appropriate permissions
- Test the command with various inputs
- Test error cases (invalid users, missing permissions, etc.)
- Verify ephemeral messages appear correctly
Testing Permissions
Testing Permissions
- Test with different role levels (admin, moderator, basic user)
- Verify permission checks work correctly
- Test in different channel types
Testing Error Handling
Testing Error Handling
- Test with missing parameters
- Test with invalid user IDs
- Test when bot lacks permissions
- Verify graceful error messages
Submitting a Pull Request
Ensure Code Quality
Before submitting:
- Run
npm run formatto format your code - Ensure
npm run buildcompletes without errors - Test your changes thoroughly
Create Pull Request
- Go to the repository on GitHub
- Click “New Pull Request”
- Select your branch
- Write a clear description of your changes
- Include screenshots/examples if applicable
Pull Request Checklist
Before submitting, ensure:- Code follows the project’s style guidelines
- Code has been formatted with Prettier
- TypeScript compiles without errors
- Changes have been tested in a Discord server
- Error handling is implemented
- Permission checks are in place (if applicable)
- Commit messages are clear and descriptive
- No sensitive data (tokens, IDs) is committed
What to Contribute
Good First Contributions
- Bug fixes for existing commands
- Improving error messages
- Adding input validation
- Documentation improvements
- Code comments for complex logic
Feature Additions
- New moderation commands
- Fun/utility commands
- Improvements to existing features
- Performance optimizations
Not Accepted
- Breaking changes without discussion
- Commands unrelated to the server’s purpose
- Code that violates Discord’s Terms of Service
- Malicious or harmful features
Required Bot Permissions
When testing, ensure your bot has these permissions:| Permission | Purpose |
|---|---|
| Kick Members | /kick command |
| Ban Members | /ban command |
| Moderate Members | /timeout command |
| Manage Messages | /clear command |
| Send Messages | All commands |
| Embed Links | Rich embed responses |
| Read Message History | Message archiving |
| Add Reactions | Reaction roles |
| View Channels | Basic functionality |
Getting Help
If you need help:- Check the documentation
- Review existing commands for examples
- Read the Discord.js documentation
- Open an issue for questions or clarifications
Code of Conduct
- Be respectful and constructive in discussions
- Focus on the code, not the person
- Welcome newcomers and help them learn
- Follow Discord’s Terms of Service and Community Guidelines