-
Notifications
You must be signed in to change notification settings - Fork 0
Developer Guide
This page is for contributors working on Battlevive Bot.
-
app/main.py- entry point. -
app/battlevive_bot/- runtime modules such asbot.py, API sync, database access, image rendering, roles, models, logging, and settings. -
app/init-db/- numbered PostgreSQL bootstrap and migration SQL files. -
app/assets/- bundled assets such as fonts. -
app/data/andapp/logs/- runtime data and logs. -
utils/- setup helpers and environment generation. -
tests/- pytest suite.
Use the repository's documented checks:
python -m compileall app utils
pytest
podman build . --file Dockerfile --tag battlevive-bot:localFor live validation, generate a fresh local .env from utils/.env.example, fill only local/test credentials, then run Compose from the repository root.
The bot periodically refreshes Battlevive data:
- Tokens are revalidated every 30 minutes.
- Users are refreshed hourly.
- Lobbies and season ratings are refreshed every 30 seconds.
- Manual
/refreshfetches users, lobbies, and season ratings, syncs the database, updates roles, and requests leaderboard reconciliation.
users.discord_id is bot-owned local state. Sync logic must preserve it and never overwrite it from upstream payloads.
Keep SQL changes as numbered files under app/init-db/. Fresh databases run the complete set automatically; existing volumes need idempotent migrations applied manually. Update the Database Schema wiki page when persistence changes.
Validate command names and permissions against app/battlevive_bot/bot.py when documenting or changing command behavior:
/rank-
/refresh- Manage Server, guild-only. /create_roles-
/config leaderboard channel- Manage Server, guild-only. -
/config leaderboard limit- Manage Server, guild-only. -
/config reset leaderboard- Manage Server, guild-only. -
/config show- Manage Server, guild-only.
/debug_get_db_data and /debug_get_battlevive_data dump users, lobbies, and ratings as JSON files. Treat them as developer/operator diagnostics only: they can expose synced user and match data, should not be run casually in shared servers, and should never be used to paste secrets or private data into issues or chat.