KCC3 is a simple badge server developed for Kraków Chombo Club. It puts the focus on providing simple interface, automate as much as possible and provide features especially useful for Rīchi Mahjong players.
- Player database (tied with their USMA and Discord IDs)
- Static (manually-assigned) badges
- Dynamic badges that are updated automatically by querying given remote server that returns list of badge bearers
- Chombo event database
- Lightweight web user interface
- Easy to use admin panel
- RESTful API to get the data stored
poetry install
poetry run python manage.py migrate
poetry run python manage.py runserver
Make sure you have RabbitMQ installed.
poetry run celery -A kcc3 worker --beat --scheduler django --loglevel=info
We encourage contributors to use predefined pre-commit
hooks — to install them in your local repo, make sure you have pre-commit
installed and run:
pre-commit install
Any third party can create their own dynamic badge by setting up a so called badge client. Badge client is a web service that gets queried once per given interval and returns a list of players that should be awarded the badge. The badge client can make use of KCC3's RESTful API to get all the data needed for granting the badge.
The communication uses conveniently defined models for data interchange
(with accompanying Serializer classes) as well as generated token for verifying
message authentication. To implement such service, one can either use
a small library inside /badgeupdater/client/
(as well as common files
inside /badgeupdater/
), or just implement the protocol (which is as easy
as parsing/serializing simple JSONs and comparing tokens).
First-parties can use convenient class called LocalBadgeClient and access the database directly, without the API as a middleware.
There are some predefined local badge clients that can be used for creating some specific dynamic badges easily.
Simple test client that grants a badge to all existing Players.
Grants the badge to each player that has ever done a chombo.