Add Discipline Log and State Transfer cogs + shared Event Registry#99
Add Discipline Log and State Transfer cogs + shared Event Registry#99blackdeathwos wants to merge 2 commits into
Conversation
- cogs/discipline.py: full infraction tracking system for alliance admins (log, view, edit, soft-delete, settings; posts to leadership channel, DMs member, stores in db/discipline.sqlite) - cogs/transfer.py: outbound state transfer manager (create event, add players by FID, set priority tiers, export ranked CSV with pass-cutoff row; stores in db/transfer.sqlite) - cogs/event_registry.py: centralised game-event registry — single source of truth for every in-game event name; fixes long-standing "Icefife" typo; discipline.py imports DISCIPLINE_EVENTS from it - cogs/bot_main_menu.py: add Discipline Log and State Transfer buttons to Settings menu (row 3) with handler methods on MainMenu cog Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Thanks for your submission. At a glance I will say that we actually have 3 separate PRs here - 3 distinct features that do not really depend on each other and 3 different decisions to make on whether to merge them or not. Whether we accept one feature does not imply we need to accept the others to. Transfer and discipline both look like features we can definitely integrate, though I'll have to consider where to put their respective buttons to avoid the menu getting messy. For event registry; I do think we could have a centralized registry for consistency, but this needs to be carefully considered. The inconsistency you point out was literally non-existent until the other cog which you created - the existing ones were already very consistent in naming, and the naming correctly matches the in-game event (except the shortened "Foundry" instead of "Foundry Battle", which was done on purpose in this case and is a legit shortening of the event name)... Can you please submit separate PRs for each feature you are proposing here? Thank you. |
PR: Discipline Log + State Transfer cogs + Event Registry
Summary
This PR adds two new cogs and a shared event registry module.
New Cog: Discipline Log (
cogs/discipline.py)A full infraction tracking system for alliance admins. Infractions are tied
to a player FID, an event type, an infraction category, and a punishment.
Each record carries an optional expiry date and is soft-deleted so the audit
trail is never lost.
Access: Settings menu → Discipline Log button, or
/discPermission requirements:
What it does:
Slash commands registered:
/disc— open the main discipline menu/disc-setup <channel>— set the leadership channel/disc-expiry <days>— set the default expiry periodDatabase:
db/discipline.sqliteNew Cog: State Transfer Manager (
cogs/transfer.py)Maintains a prioritised list of players nominated for an outbound state
transfer. Admins create a named event, add players by FID, assign priority
tiers, and export a ranked CSV with an automatic pass-cutoff row.
Access: Settings menu → State Transfer button, or
/transferPermission requirements:
What it does:
Slash commands registered:
/transfer— open the transfer event managerDatabase:
db/transfer.sqliteNew Module: Event Registry (
cogs/event_registry.py)A centralised game-event registry — single source of truth for every
in-game event referenced across the bot.
The problem it solves:
Before this module, each cog maintained its own event list with inconsistent
naming. The same real-world events appeared under different names:
It also fixes a long-standing typo:
"Icefife Warhymn League"→"Icefire Warhymn League".How it works:
REGISTRYis a list of dicts — one per event — each carrying:key— stable snake_case identifier (matches OCR parser keys)display_name— canonical in-game name shown in all menusshort_name— abbreviated form for space-constrained contextsdiscipline,attendance,notifications,legion,ocr_keylegacy_names— previous names used in other cogs (migration reference)Pre-filtered lists are derived from the registry at import time:
Cogs updated in this PR:
discipline.py— importsDISCIPLINE_EVENTSfrom registry (replaces hardcoded list)Cogs that should adopt the registry in a follow-up:
attendance.py— replaceEVENT_TYPESandLEGION_EVENT_TYPESnotification_event_types.py— align key names withdisplay_namevaluesattendance_ocr_parsers.py—labelfields already match; usekeyfor cross-referencingData migration note:
Event names are stored as plain strings in
db/discipline.sqliteanddb/attendance.sqlite. Renaming an event here does not update existing rows.The
legacy_namesfield on each registry entry documents the old strings soa migration script can be written if needed:
Running these is optional — existing records still display correctly using
whatever string was stored.
Files changed
cogs/discipline.pycogs/transfer.pycogs/event_registry.pycogs/bot_main_menu.py