Skip to content

Development

Philippe edited this page Nov 13, 2026 · 1 revision

Development

Setup

git clone https://github.com/Two-Play/Crafty-Discord-bot.git
cd Crafty-Discord-bot
python -m venv venv
source venv/bin/activate
pip install -r requirements-dev.txt

Tests and linters

python -m unittest                      # all tests
python -m unittest tests.test_servers_cog
coverage run -m unittest && coverage report
flake8 core tests                       # max line length 120
pylint core

CI runs the tests on every push. The code is clean under flake8 and pylint; please keep it that way.

Project structure

All code lives in the core package:

Module Purpose
main.py Entry point (python -m core)
config.py Reads the environment variables into Settings
crafty.py Client for the Crafty REST API
bot.py The Discord bot and its error handling
cogs/ Server commands, admin commands and auto stop
flags.py Feature flags
log.py Logging setup and the in-memory log for the dashboard
web/ The web dashboard

CLAUDE.md in the repository describes the architecture in more detail.

Contributing

  1. Fork the repository and create a branch from develop.
  2. Make your changes with tests, and run the tests and linters.
  3. Open a pull request against develop. master is the release branch.

Bugs and ideas go to the issue tracker.

Clone this wiki locally