To add a language, copy the English catalog to a file named for the new two-letter ISO 639-1 code, such as nl.json. Translate the values and preserve the keys and format placeholders. Then register the code and its native name in LANGUAGES in texts.py. The picker and Telegram command menu use that registry.
The project uses Alembic to manage the SQLite schema.
At runtime the database schema is created or upgraded by calling backend.storage.db.init_db().
It uses the Alembic Python API to upgrade to head. The equivalent CLI command is:
python -m alembic -c backend/alembic.ini upgrade headEvery entrypoint that needs a database should call init_db() once before using the storage layer.
From the project root, set BOT_TOKEN in .env or in the environment, then run:
python -m alembic -c backend/alembic.ini upgrade headThis upgrades the database pointed to by backend.storage.db.DB_PATH to the latest migration.
When you change the database schema, you must add a new Alembic migration.
The recommended workflow is:
-
Edit the schema in code only after the migration is created and applied.
-
Create a new migration file:
python -m alembic -c backend/alembic.ini revision -m "describe_change"
-
Edit the generated revision file in
backend/alembic/versions/and write theupgradeanddowngradefunctions using raw SQL for SQLite. -
Apply the migration:
python -m alembic -c backend/alembic.ini upgrade head
SQLite support is limited for automatic schema diffs, so migrations are written by hand.
Tests that rely on the database use the same migrations:
-
backend.storage.db.DB_PATHcan be patched to point to a temporary file. -
backend.storage.db.init_db()is called to apply all migrations to that temporary database.
Storage integration tests use the Alembic revisions against temporary SQLite databases.
The Docker entrypoint applies the migrations before starting the bot:
python -m alembic -c backend/alembic.ini upgrade head
python bot.pyOn pushes to main or master and pull requests targeting either branch, CI uses Python 3.11, installs .[dev], applies migrations with a test token, and runs pre-commit and mypy. It then runs two test groups:
pytest --import-mode=importlib -m "not storage_db"
pytest --import-mode=importlib -m "storage_db" --no-covCoverage enforces a minimum of 80%. Docker Build and Compose check image and container setup. The Docker healthcheck verifies Python imports. Docs checks links when documentation changes. Security runs Bandit, pip-audit, and Trivy on the same branches and weekly.
Release publishes the Docker image to GHCR for v* tags using GITHUB_TOKEN. It creates a GitHub Release only for tags matching vX.0.0.