feat(teams): resolve team dividers by role ID instead of name
Divider placement matched the divider role by its exact Discord name, so renaming the role in Discord silently broke positioning. Switch the TEAM_DIVIDER_<SUFFIX> config to hold a role ID; resolve the ID to the role's current name in apply_team_role_positions and keep the existing name-based ordering maths downstream unchanged. - config._parse_team_dividers now parses values as ints (rejects non-ints) - resolve_divider / _team_divider cache / get_team_dividers return IDs - apply_team_role_positions resolves each ID via guild.get_role once - .env.example documents IDs and ships the CS2/LoL divider role IDs - resolve_divider tests updated to assert IDs Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XPRsW4tazVtYi2jNzVQkre
This commit is contained in:
@@ -113,18 +113,18 @@ def test_parse_team_sections_title_does_not_leak_to_untitled_block():
|
||||
# --- resolve_divider (section title -> configured divider role) ------------
|
||||
|
||||
DIVIDERS = {
|
||||
"cs2_2026": "====== COUNTER-STRIKE 2 2026 ======",
|
||||
"lol_2026": "===== LEAGUE OF LEGENDS 2026 =====",
|
||||
"cs2_2026": 1498736834656604251,
|
||||
"lol_2026": 1498736949706490017,
|
||||
}
|
||||
|
||||
|
||||
def test_resolve_divider_matches_game_and_year():
|
||||
assert sheets.resolve_divider(
|
||||
"[merged] TipiLAN 2026 CS2 Registration Log", DIVIDERS
|
||||
) == "====== COUNTER-STRIKE 2 2026 ======"
|
||||
) == 1498736834656604251
|
||||
assert sheets.resolve_divider(
|
||||
"[merged] TipiLAN 2026 LoL Registration Log", DIVIDERS
|
||||
) == "===== LEAGUE OF LEGENDS 2026 ====="
|
||||
) == 1498736949706490017
|
||||
|
||||
|
||||
def test_resolve_divider_year_scoped_key_ignores_other_years():
|
||||
@@ -132,9 +132,9 @@ def test_resolve_divider_year_scoped_key_ignores_other_years():
|
||||
|
||||
|
||||
def test_resolve_divider_prefers_the_most_specific_match():
|
||||
dividers = {"cs2": "== CS2 ALL YEARS ==", "cs2_2026": "== CS2 2026 =="}
|
||||
assert sheets.resolve_divider("TipiLAN 2026 CS2 Log", dividers) == "== CS2 2026 =="
|
||||
assert sheets.resolve_divider("TipiLAN 2025 CS2 Log", dividers) == "== CS2 ALL YEARS =="
|
||||
dividers = {"cs2": 111, "cs2_2026": 222}
|
||||
assert sheets.resolve_divider("TipiLAN 2026 CS2 Log", dividers) == 222
|
||||
assert sheets.resolve_divider("TipiLAN 2025 CS2 Log", dividers) == 111
|
||||
|
||||
|
||||
def test_resolve_divider_no_config_or_no_title_is_none():
|
||||
|
||||
Reference in New Issue
Block a user