refactor(teams): move team-role sync to the economy/community bot
The team-role feature was aimed at the wrong bot. Tournament participants live in the economy/community guild, but team-role sync had been bolted onto the dev bot's roster sync (sync_member), which bails out for anyone missing from the internal member sheet - so it could never reach its actual audience. Decouple it: keep the (roster-independent) team-sheet parsing, pull the team wiring off the dev/member-sync path, and re-home it on the economy bot. - core/member_sync: revert sync_member to add-only (drop team block + SyncResult.roles_removed); add roster-independent sync_team_role and a whole-guild sync_all_team_roles returning a reporting summary. Still only ever touches role NAMES present in the team sheet. - commands/economy_team_commands: new admin-only /teamsync command. - bot.py: hourly team_sync_hourly task (economy-only, no-op unless TEAM_SHEET_ID is set; first tick at boot covers startup load); register /teamsync under the economy profile; drop the dev-side startup load. - commands/dev_member_commands: /check no longer refreshes teams or reports removed roles. - strings + .env.example: TEAMSYNC_UI, CMD[teamsync], document TEAM_SHEET_ID. - tests: retarget sync tests to sync_team_role; add sync_all_team_roles case. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01R6JZkyszyDFuFtk25WBbcR
This commit is contained in:
@@ -11,6 +11,7 @@ __all__ = [
|
||||
'BIRTHDAY_UI',
|
||||
'BIRTHDAY_MONTHS',
|
||||
'CHECK_UI',
|
||||
'TEAMSYNC_UI',
|
||||
]
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
@@ -91,7 +92,25 @@ CHECK_UI: dict[str, str] = {
|
||||
"detail_error": "⚠️ {error}",
|
||||
"detail_nickname": "hüüdnimi",
|
||||
"detail_roles_added": "+rollid: {roles}",
|
||||
"detail_roles_removed": "-rollid: {roles}",
|
||||
"detail_changed": "🔧 **{name}**: {parts}",
|
||||
"ids_filled": "\n🔑 Täideti **{count}** puuduvat kasutaja ID-d.",
|
||||
}
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# /teamsync UI strings (tournament team-role sync from the registration sheet)
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
TEAMSYNC_UI: dict[str, str] = {
|
||||
"disabled": "⚠️ Tiimide sünkroonimine on välja lülitatud (TEAM_SHEET_ID puudub).",
|
||||
"refresh_error": "⚠️ Registreerimistabeli laadimine ebaõnnestus: {error}",
|
||||
"done": "**Tiimide sünkroonimine lõpetatud!**",
|
||||
"scanned": "👥 Kontrollitud liikmeid: {count}",
|
||||
"assigned": "✅ Tiimirolle antud: {count}",
|
||||
"removed": "➖ Tiimirolle eemaldatud: {count}",
|
||||
"created": "🆕 Loodud uusi tiimirolle: {roles}",
|
||||
"errors": "⚠️ Vead: {count}",
|
||||
"no_changes": "✨ Kõik tiimirollid olid juba korras.",
|
||||
"changes_header": "**Muudatused:**",
|
||||
"changes_more": "... ja {count} rohkem",
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user