fix: move TIER_BADGES to module level and fix unknown tier fallback
All checks were successful
Build Docker Image / build (pull_request) Successful in 1m25s

- TIER_BADGES dict moved from inside get_card_embeds() to module level
- Unknown tiers now show no badge instead of silently promoting to [SF]

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Cal Corum 2026-03-23 10:39:56 -05:00
parent cc02d6db1e
commit 1f26020bd7

View File

@ -23,6 +23,9 @@ from utils import (
from search_utils import *
from discord_utils import *
# Refractor tier badge prefixes for card embeds (T0 = no badge)
TIER_BADGES = {1: "BC", 2: "R", 3: "GR", 4: "SF"}
async def get_player_photo(player):
search_term = player["bbref_id"] if player["bbref_id"] else player["p_name"]
@ -115,8 +118,8 @@ async def get_card_embeds(card, include_stats=False) -> list:
evo_state = await db_get(f"evolution/cards/{card['id']}")
if evo_state and evo_state.get("current_tier", 0) > 0:
tier = evo_state["current_tier"]
TIER_BADGES = {1: "BC", 2: "R", 3: "GR", 4: "SF"}
tier_badge = f"[{TIER_BADGES.get(tier, 'SF')}] "
badge = TIER_BADGES.get(tier)
tier_badge = f"[{badge}] " if badge else ""
except Exception:
pass