feat: use Discord Choice menus for /refractor status parameters
All checks were successful
Ruff Lint / lint (pull_request) Successful in 22s
All checks were successful
Ruff Lint / lint (pull_request) Successful in 22s
Replace freeform text inputs with dropdown selections: - card_type: Batter, Starting Pitcher, Relief Pitcher - tier: T0-T4 with names (Base Card through Superfractor) - progress: "Close to next tier" option - Removed season param (not useful for current UX) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
a8b4d6cdbb
commit
a53cc5cac3
@ -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:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user