Development Setup
See Getting Started for full setup instructions. Quick start:Project Scripts
Code Structure
Adding a Slash Command
Create a new file insrc/commands/slash/<Category>/:
DEV_GUILD_ID.
Adding a Developer Command
Create a new file insrc/commands/devOnly/Developers/:
Adding a Prefix Command
Create a new file insrc/commands/prefix/<Category>/:
config.handler.commands.prefix).
Adding a Component Handler
Button
Create insrc/components/buttons/:
Select Menu
Create insrc/components/selects/:
Modal
Create insrc/components/modals/:
Adding a Context Menu
Create insrc/contextmenus/:
Adding a Database Model
- Add the model to
prisma/schema.prisma - Run
npx prisma generateto regenerate the client - Create a schema re-export in
src/schemas/:
- Import and use in your command:
Testing
Running Tests
node:test) and do not require MongoDB, Discord, or any external service.
Writing Tests
Create test files intests/ with the .test.js extension:
Test Philosophy
- Tests should be pure unit tests that can run without external services
- Focus on business logic, not Discord API interactions
- Test edge cases for economy calculations, permission checks, and data validation
- Use
node --checkfor syntax verification of command files
Existing Test Coverage
Code Conventions
Command Handler Signature
All slash and developer commands use:Database Access
Always use the Prisma model delegates via schema re-exports:Error Handling
- Use
try/catcharound database operations and Discord API calls - Log errors with
log(error, "err")fromsrc/functions - For interaction handlers, always ensure a reply is sent (even on error)
- Use
ephemeral: truefor error messages
Logging
Use thelog function from src/functions:
Pull Request Guidelines
- Run
npm testbefore opening a PR — all tests must pass - Run
node --checkon any modified command files to verify syntax - Add regression tests for bug fixes when practical
- Keep commits focused and descriptive
- Update documentation if adding new features or changing behavior