0.2.0: keep all chat, @ staff chat and SimpleAdmin's say commands too

wh_messages now holds every message with a channel (all, team, pm, staff,
to_staff, css_say/asay/psay/csay/hsay/cssay) and NULL sender columns for
the console. Seen by a catch-all listener added in Load, which CSS runs
before CS2-SimpleAdmin's (added in OnAllPluginsLoaded), so gagged lines and
@ chat are kept before SimpleAdmin stops or rewrites them. Replaces
001_CreateTables in place: drop wh_messages and wh_migrations first.
This commit is contained in:
Astra 2026-10-05 14:57:19 +01:00
parent c414e8a770
commit 06823c2d47
5 changed files with 146 additions and 29 deletions

View file

@ -69,19 +69,36 @@ tables created on first load and tracked in `wh_migrations`. All times are UTC.
### History
With `History` on, each `/pm` and `/r`, sent or not, is a row in `wh_messages`: when (`sent_at`),
`server_id` (SimpleAdmin's), `map`, the sender's and recipient's SteamID64, name, team (0 none,
1 spectator, 2 T, 3 CT) and whether alive, the `target` as typed, the `message`, and the `result`:
`sent`, `blocked`, `gagged`, `cooldown`, `too_long`, `no_target`, `ambiguous` or `group_target`. The
recipient columns are `NULL` when no single player was found.
With `History` on, every message is a row in `wh_messages`, sent or not:
| `channel` | What |
|---|---|
| `all`, `team` | Normal chat, including `!`/`/` commands (`result` `command`) other than the ones below |
| `pm` | `/pm`, `/w` and `/r` |
| `staff`, `to_staff` | `@` team chat, from staff (`@css/chat`) or from a player to staff |
| `css_say`, `css_asay`, `css_psay`, `css_csay`, `css_hsay`, `css_cssay` | SimpleAdmin's say commands, typed in console, sent over RCON (the web panel too), or as `!asay` and the like in chat. `@` in all chat from staff is `css_say`, as SimpleAdmin runs it |
Each row has when (`sent_at`), `server_id` (SimpleAdmin's), `map`, the sender's SteamID64, name,
team (0 none, 1 spectator, 2 T, 3 CT) and whether alive (all `NULL` and "Console" for the server
console), the `message`, and the `result`: `sent`, `gagged` (stopped by a gag or silence; `@` team
chat gets through one), `command`, or for `pm` `blocked`, `cooldown`, `too_long`, `no_target`,
`ambiguous` or `group_target`. PMs also have the recipient's SteamID64, name, team and whether alive,
and `target` as typed (`css_psay` has `target` too). Staff commands are logged as typed, so one the
sender wasn't allowed to use still says `sent`.
Chat is seen by a catch-all command listener added in `Load`. CSS runs catch-alls before any
per-command listener (CS2-Tags' `say`, say), in the order they were added, and stops at the first
that returns `Stop`. CS2-SimpleAdmin adds its catch-all (which stops gagged players and handles `@`)
in `OnAllPluginsLoaded`, after every plugin's `Load`, so Whisper always sees a line before it's
stopped or rewritten. Keep that in mind if SimpleAdmin ever moves its listener into `Load`.
`css_whisper_history off` stops it at once and saves the setting to `Whisper.json`; rows already kept
stay. Writes go in order on a background task and spool to `plugins/Whisper/spool.jsonl` while the
database is down.
```sql
SELECT sent_at, map, sender_name, sender_steamid64, sender_team, sender_alive,
recipient_name, recipient_steamid64, recipient_team, recipient_alive, message, result
SELECT sent_at, map, channel, sender_name, sender_steamid64, sender_team, sender_alive,
recipient_name, message, result
FROM wh_messages ORDER BY sent_at DESC LIMIT 50;
```