From 7a3c21f6bd3b141680be2973a9a281a1704e6ced Mon Sep 17 00:00:00 2001 From: Cal Corum Date: Wed, 25 Mar 2026 16:18:07 -0500 Subject: [PATCH] fix: align refractor status command with API response schema MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - data.get("cards") → data.get("items") to match list endpoint response - formula_value → current_value (API field name) - card_type from top-level → track.card_type (nested in track object) - Add limit=500 param so API returns all cards instead of default 10 Co-Authored-By: Claude Opus 4.6 (1M context) --- cogs/refractor.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/cogs/refractor.py b/cogs/refractor.py index 49674e6..410adb3 100644 --- a/cogs/refractor.py +++ b/cogs/refractor.py @@ -74,9 +74,10 @@ def format_refractor_entry(card_state: dict) -> str: [========--] 120/149 (PA+TB×2) — T1 → T2 """ player_name = card_state.get("player_name", "Unknown") - card_type = card_state.get("card_type", "batter") + track = card_state.get("track", {}) + card_type = track.get("card_type", "batter") current_tier = card_state.get("current_tier", 0) - formula_value = card_state.get("formula_value", 0) + formula_value = card_state.get("current_value", 0) next_threshold = card_state.get("next_threshold") tier_label = TIER_NAMES.get(current_tier, f"T{current_tier}") @@ -106,7 +107,7 @@ def apply_close_filter(card_states: list) -> list: result = [] for state in card_states: current_tier = state.get("current_tier", 0) - formula_value = state.get("formula_value", 0) + formula_value = state.get("current_value", 0) next_threshold = state.get("next_threshold") if current_tier >= 4 or not next_threshold: continue @@ -166,7 +167,7 @@ class Refractor(commands.Cog): ) return - params = [("team_id", team["id"])] + params = [("team_id", team["id"]), ("limit", 500)] if card_type: params.append(("card_type", card_type)) if season is not None: @@ -181,7 +182,7 @@ class Refractor(commands.Cog): ) return - items = data if isinstance(data, list) else data.get("cards", []) + items = data if isinstance(data, list) else data.get("items", []) if not items: await interaction.edit_original_response( content="No refractor data found for your team."