Thank you for your interest in contributing to RABot! This document provides guidelines and instructions for contributing to the official RetroAchievements Discord bot.
- Bun 1.3.10 or higher
- A Discord application for testing (create one at Discord Developer Portal)
- A RetroAchievements Web API key for local bot startup
- Basic knowledge of TypeScript and Discord.js
-
Fork and clone the repository
git clone https://github.com/YOUR-USERNAME/RABot-Next.git cd RABot-Next -
Install dependencies
bun install
-
Set up environment variables
cp .env.example .env
Edit
.envwith your Discord bot token and other required configuration. -
Initialize the database
bun run db:generate bun run db:migrate bun run db:seed # Optional: adds default teams -
Deploy global slash commands
bun run deploy-commands
-
Run the bot in development mode
bun run dev
Always create a new branch for your changes:
git checkout -b feature/your-feature-name
# or
git checkout -b fix/issue-description- Follow the existing code style - The project uses oxlint and oxfmt for consistency.
- Write TypeScript - All code must be properly typed.
- Add tests - New functionality should include tests.
- Update documentation - Keep README and JSDoc comments up to date.
Before committing, ensure your code passes all checks:
bun run verify # Formats, lint-fixes, type checks, and testsUse bun run ci when you want the non-mutating CI check sequence.
Individual checks:
bun run format:check # Check formatting without writing
bun run lint # Check code style
bun run lint:fix # Auto-fix lint issues
bun run tsc # TypeScript type checking (via tsgo)
bun run test # Run tests (via vitest)- Use commitizen-style conventional commits format:
feat:for new featuresfix:for bug fixesdocs:for documentation changestest:for test additions/changesrefactor:for code refactoringchore:for maintenance tasks
Examples:
git commit -m "feat: add team export command"
git commit -m "fix: handle empty poll options correctly"
git commit -m "docs: update setup instructions for Bun 1.3"- Push your branch to your fork
- Open a pull request against the
mainbranch - Include in the pull request description:
- Clear description of changes
- Testing instructions
- Any breaking changes
- Related issues
- Use strict TypeScript settings (already configured).
- Define interfaces for all data structures.
- Avoid
anytype - useunknownif type is truly unknown. - Prefer
interfaceovertypefor object shapes.
- Commands go in
src/commands/(legacy) orsrc/slash-commands/(preferred). - Business logic belongs in
src/services/. - Shared utilities go in
src/utils/. - Shared test helpers go in
src/test/. - Database operations use the service layer pattern.
When creating new commands:
- Prefer slash commands over legacy prefix commands.
- Use the
SlashCommandinterface fromsrc/models/. - Include proper error handling and user feedback.
- Add cooldowns where appropriate.
- Consider guild restrictions if command is server-specific.
Example slash command structure:
import { SlashCommandBuilder } from "discord.js";
import type { SlashCommand } from "../models";
export default {
data: new SlashCommandBuilder().setName("example").setDescription("Example command"),
cooldown: 5,
async execute(interaction, client) {
// Command logic here
},
} satisfies SlashCommand;- Write tests for services and utilities.
- Use
createTestDb()fromsrc/test/create-test-db.tsfor service tests that need a real database. - Use the existing mock utilities in
src/test/mocks/for Discord and API mocks. - Test both success and error cases.
- Keep tests focused and independent.
- Comments should explain "why", not "what".
- Add JSDoc comments for public functions and complex logic.
- Code passes
bun run verify. - Tests are included for new functionality.
- Documentation is updated if needed.
- No console.logs or debug code left in.
- Commit messages follow conventional format.
- What - Brief summary of changes.
- Why - Motivation and context.
- How - Technical approach if non-obvious.
- Testing - How to test the changes.
- Breaking Changes - Any compatibility issues.
- PRs require at least one approval.
- Address reviewer feedback promptly.
- Keep PRs focused - one feature/fix per PR.
- Be open to suggestions and constructive criticism.
Please follow our Code of Conduct in all interactions.
- Check existing issues and discussions first.
- Join our Discord server for community support.
- Use clear, descriptive titles for issues.
- Provide reproduction steps for bugs.
Contributors will be recognized in our release notes and documentation. Thank you for helping improve RABot!