add per-user locks, fix game conditons, startup config validation
This commit is contained in:
@@ -20,7 +20,7 @@
|
||||
|
||||
Checklist - do all of these, in order:
|
||||
|
||||
1. **`economy.py`** - add the `do_<cmd>` async function with cooldown check, logic, `_commit`, and `_txn` logging
|
||||
1. **`economy.py`** - add the `do_<cmd>` async function with cooldown check, logic, `_commit`, and `_txn` logging. Decorate it with `@_serialized()` (add `house=True` if it calls `_credit_house`, `id_args=(0, 1)` if it mutates two users) - this holds the per-user lock that prevents concurrent commands from overwriting each other's PocketBase writes.
|
||||
2. **`economy.py`** - add the cooldown to `COOLDOWNS` dict if it has one
|
||||
3. **`economy.py`** - add the EXP reward to `EXP_REWARDS` dict
|
||||
3a. **PocketBase** - if the function stores new fields, add them as columns via `python scripts/add_stats_fields.py` (or manually in the PB admin UI at `http://127.0.0.1:8090/_/`). Fields not in the PB schema are silently dropped on PATCH.
|
||||
@@ -36,6 +36,8 @@ Checklist - do all of these, in order:
|
||||
13. **`strings.py` `REMINDER_OPTS`** - add a reminder option if the command needs one
|
||||
14. **`bot.py` `_maybe_remind`** - if the command has an item-modified cooldown, add an `elif` branch
|
||||
|
||||
> **Safety net:** `economy.validate_config()` runs at boot (called from `bot.py __main__`) and cross-checks COOLDOWNS↔CD_MSG, SHOP↔SHOP_TIERS↔SHOP_LEVEL_REQ↔ITEM_DESCRIPTIONS, the /help shop page (emoji, cost, tier tag), REMINDER_OPTS, and the slots tables. A forgotten checklist step crashes the bot at startup with a message naming the missing entry instead of failing at command time.
|
||||
|
||||
---
|
||||
|
||||
## Adding a New Shop Item
|
||||
|
||||
Reference in New Issue
Block a user