diff --git a/cogs/refractor.py b/cogs/refractor.py index 89436df..a2e7284 100644 --- a/cogs/refractor.py +++ b/cogs/refractor.py @@ -15,6 +15,7 @@ from typing import Optional import discord from discord import app_commands +from discord.app_commands import Choice from discord.ext import commands from api_calls import db_get @@ -142,19 +143,34 @@ class Refractor(commands.Cog): name="status", description="Show your team's refractor progress" ) @app_commands.describe( - card_type="Card type filter (batter, sp, rp)", - season="Season number (default: current)", - tier="Filter by current tier (0-4)", - progress='Use "close" to show cards within 80% of their next tier', + card_type="Filter by card type", + tier="Filter by current tier", + progress="Filter by advancement progress", page="Page number (default: 1, 10 cards per page)", ) + @app_commands.choices( + card_type=[ + Choice(value="batter", name="Batter"), + Choice(value="sp", name="Starting Pitcher"), + Choice(value="rp", name="Relief Pitcher"), + ], + tier=[ + Choice(value="0", name="T0 — Base Card"), + Choice(value="1", name="T1 — Base Chrome"), + Choice(value="2", name="T2 — Refractor"), + Choice(value="3", name="T3 — Gold Refractor"), + Choice(value="4", name="T4 — Superfractor"), + ], + progress=[ + Choice(value="close", name="Close to next tier (≥80%)"), + ], + ) async def refractor_status( self, interaction: discord.Interaction, - card_type: Optional[str] = None, - season: Optional[int] = None, - tier: Optional[int] = None, - progress: Optional[str] = None, + card_type: Optional[Choice[str]] = None, + tier: Optional[Choice[str]] = None, + progress: Optional[Choice[str]] = None, page: int = 1, ): """Show a paginated view of the invoking user's team refractor progress.""" @@ -171,13 +187,11 @@ class Refractor(commands.Cog): offset = (page - 1) * PAGE_SIZE params = [("team_id", team["id"]), ("limit", PAGE_SIZE), ("offset", offset)] if card_type: - params.append(("card_type", card_type)) - if season is not None: - params.append(("season", season)) + params.append(("card_type", card_type.value)) if tier is not None: - params.append(("tier", tier)) + params.append(("tier", tier.value)) if progress: - params.append(("progress", progress)) + params.append(("progress", progress.value)) data = await db_get("refractor/cards", params=params) if not data: