Files
tipibot/strings/member.py
Rene Arumetsa bd3fb7d3b8 feat(teams): add opt-in /teamsync reposition to tidy existing team roles
Creation-time placement only positions NEW team roles. Team roles made before
divider placement existed (sitting at the bottom of the role list) stayed put.

Add `reposition_team_roles(guild)` and expose it via `/teamsync reposition:true`
(off by default, so the hourly task never reorders roles on its own). It moves
each EXISTING team role under its game's divider, sheet-driven:

- a role's game/divider comes from sheets.get_game_for_team;
- roles whose team is no longer in the sheet (or game unknown) are left alone;
- idempotent: a role already within its section band (below its own divider,
  above the next divider down) is skipped, so re-runs move nothing.

Adds RepositionSummary, TEAMSYNC_UI/OPT strings, and tests.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01R6JZkyszyDFuFtk25WBbcR
2026-08-28 16:05:38 +03:00

120 lines
5.1 KiB
Python
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""Member sync, /check, birthdays, channel + economy-setup admin UI.
Auto-split from the original strings.py; edit strings here.
"""
__all__ = [
'MEMBER_UI',
'MEMBER_FIELDS',
'ECONOMYSETUP_UI',
'CHANNEL_UI',
'BIRTHDAY_UI',
'BIRTHDAY_MONTHS',
'CHECK_UI',
'TEAMSYNC_UI',
]
# ---------------------------------------------------------------------------
# /allowchannel /denychannel /channels UI strings
# ---------------------------------------------------------------------------
MEMBER_UI: dict[str, str] = {
"title": "👤 {name}",
"age_field": "Vanus",
"age_val": "{age}a",
}
MEMBER_FIELDS: list[tuple[str, str]] = [
("Nimi", "Nimi"),
("Organisatsioon", "Organisatsioon"),
("Valdkond", "Valdkond"),
("Roll", "Roll"),
("Sünnipäev", "Sünnipäev"),
("Meil", "Meil"),
("Telefon", "Telefon"),
("Discord", "Discord"),
("User ID", "Kasutaja ID"),
("Discordis synced?", "Sünkroniseeritud"),
("Groupi lisatud?", "Grupis"),
]
ECONOMYSETUP_UI: dict[str, str] = {
"created_field": "✅ Loodud",
"existing_field": "♻️ Juba olemas",
"footer": "Rollid on nüüd boti rolli all õiges järjekorras.",
}
CHANNEL_UI: dict[str, str] = {
"already_allowed": " {channel} on juba lubatud kanalite nimekirjas.",
"added": "{channel} lisatud. Bot vastab käskudele nüüd ainult lubatud kanalites.",
"not_in_list": " {channel} pole lubatud kanalite nimekirjas.",
"removed": "{channel} eemaldatud lubatud kanalite nimekirjast.",
"removed_last": "{channel} eemaldatud. Lubatud kanalite nimekiri on nüüd tühi - bot vastab kõikides kanalites.",
"list_title": "📋 Lubatud kanalid",
"list_empty": "Lubatud kanalite nimekiri on **tühi** - bot vastab käskudele kõikides kanalites.\n\nKasuta `/allowchannel`, et piirata kindlatele kanalitele.",
"list_filled": "Bot vastab käskudele ainult nendes kanalites:\n\n{lines}\n\n-# Kasuta `/allowchannel` / `/denychannel` nimekirja muutmiseks.",
}
# ---------------------------------------------------------------------------
# /birthdays UI
# ---------------------------------------------------------------------------
BIRTHDAY_UI: dict[str, str] = {
"no_entries": "Sellel kuul sünnipäevi ei ole.",
"today": "täna 🎉",
"tomorrow": "homme",
"in_days": "{days}p pärast",
"footer": "Leht {month}/12 · {month_name}",
}
BIRTHDAY_MONTHS: list[str] = [
"Jaanuar", "Veebruar", "Märts", "Aprill", "Mai", "Juuni",
"Juuli", "August", "September", "Oktoober", "November", "Detsember",
]
# ---------------------------------------------------------------------------
# /check summary strings
# ---------------------------------------------------------------------------
CHECK_UI: dict[str, str] = {
"sheet_stats_header": "📊 **Tabeli statistika** - {total} liiget",
"stat_ok": "✅ **{label}**: kõik täidetud",
"stat_warn": "⚠️ **{label}** puudub ({count}): {names}{more}",
"stat_more": " (+{count} veel)",
"stat_uid": "Kasutaja ID",
"stat_discord": "Discordi kasutajanimi",
"stat_bday": "Sünnipäev",
"no_name": "(no name)",
"done": "**Kontroll lõpetatud!**",
"already_ok": "✅ Juba korras: {count}",
"fixed": "🔧 Parandatud: {count}",
"not_found": "❓ Pole tabelis: {count}",
"bday_pings": "🎂 Sünnipäeva teavitused: {count}",
"errors": "⚠️ Vead: {count}",
"details_header": "**Üksikasjad:**",
"details_more": "... ja {count} rohkem",
"detail_error": "⚠️ {error}",
"detail_nickname": "hüüdnimi",
"detail_roles_added": "+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",
"reposition_header": "**Ümberpaigutus:**",
"repositioned": "📦 Ümber paigutatud rolle: {count}",
"reposition_none": "✨ Olemasolevad tiimirollid olid juba õiges sektsioonis.",
}