[www] discord link sync

This commit is contained in:
Devin Zuczek
2026-10-05 17:27:00 -04:00
parent 4e3301ade8
commit aceaf54519
5 changed files with 144 additions and 3 deletions
+8
View File
@@ -270,6 +270,14 @@ skip that one link and leave its snapshot for the next run, and the sweep honors
Discord's rate-limit headers between calls. `wrangler tail www` shows a summary line per
run: `discord role sweep: refreshed N of M links, …`.
A developer can run the same sweep on demand with `POST /api/staff/discord-roles/sync`
(developer role required, empty body). It answers with the run's summary —
`{ skipped, refreshed, changed, gone, failed, halted }` — so a run that stops on its first
call reports WHY (`halted: "the bot is not in the guild (Unknown Guild)"`) instead of
leaving a silent log line on a worker with observability off. Use it after changing the
bot token or inviting the bot, or when the role drop needs this morning's roles. The run
is written to `audit_log` as `sync_discord_roles` against the developer who pressed it.
## Development
### Run in dev mode