From 57a64127babfbee57988e56bc1fdf3b973b4f87d Mon Sep 17 00:00:00 2001 From: Cal Corum Date: Sun, 22 Mar 2026 23:34:59 -0500 Subject: [PATCH 1/2] fix: daily check-in interaction migration + paperdex dupe detection Fix 1 (closes #19): Complete the migration of daily_checkin to discord.Interaction. Remove greeting = assignments and TODO comment; replace await greeting.edit(...) with await interaction.edit_original_response(...). Fix 2 (closes #23): Implement paperdex dupe detection in get_card_embeds(). Query cards API by player_id + team_id and display a 'Dupes' field on the embed showing how many duplicate copies the team owns. Co-Authored-By: Claude Sonnet 4.6 --- cogs/economy.py | 7 +++---- helpers/main.py | 10 +++++----- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/cogs/economy.py b/cogs/economy.py index 16b7220..ebb4058 100644 --- a/cogs/economy.py +++ b/cogs/economy.py @@ -567,12 +567,11 @@ class Economy(commands.Cog): check_count = check_ins["count"] % 5 - # TODO: complete the migration to an interaction # 2nd, 4th, and 5th check-ins if check_count == 0 or check_count % 2 == 0: # Every fifth check-in if check_count == 0: - greeting = await interaction.edit_original_response( + await interaction.edit_original_response( content=f"Hey, you just earned a Standard pack of cards!" ) pack_channel = get_channel(interaction, "pack-openings") @@ -587,7 +586,7 @@ class Economy(commands.Cog): # Every second and fourth check-in else: - greeting = await interaction.edit_original_response( + await interaction.edit_original_response( content=f"Hey, you just earned a player card!" ) pack_channel = interaction.channel @@ -622,7 +621,7 @@ class Economy(commands.Cog): p_query["packs"], extra_val=check_ins["count"] ) if not pack_ids: - await greeting.edit( + await interaction.edit_original_response( content=f"I was not able to create these cards {await get_emoji(interaction, 'slight_frown')}" ) return diff --git a/helpers/main.py b/helpers/main.py index 3e499e7..99ec420 100644 --- a/helpers/main.py +++ b/helpers/main.py @@ -181,11 +181,11 @@ async def get_card_embeds(card, include_stats=False) -> list: name="Collected By", value=f"{count} team{'s' if count != 1 else ''}" ) - # TODO: check for dupes with the included paperdex data - # if card['team']['lname'] != 'Paper Dynasty': - # team_dex = await db_get('cards', params=[("player_id", card["player"]["player_id"]), ('team_id', card['team']['id'])]) - # count = 1 if not team_dex['count'] else team_dex['count'] - # embed.add_field(name='# Dupes', value=f'{count - 1} dupe{"s" if count - 1 != 1 else ""}') + if card['team']['lname'] != 'Paper Dynasty': + team_dex = await db_get('cards', params=[("player_id", card["player"]["player_id"]), ('team_id', card['team']['id'])]) + copy_count = team_dex['count'] if team_dex['count'] else 1 + dupe_count = copy_count - 1 + embed.add_field(name='Dupes', value=f'{dupe_count} dupe{"s" if dupe_count != 1 else ""}') # embed.add_field(name='Team', value=f'{card["player"]["mlbclub"]}') if card["player"]["franchise"] != "Pokemon": -- 2.25.1 From 1c03d9147886aa76887655e382fd4561a03dadf4 Mon Sep 17 00:00:00 2001 From: Cal Corum Date: Sun, 22 Mar 2026 23:38:13 -0500 Subject: [PATCH 2/2] fix: guard paperdex dupe detection against None API response db_get returns None on API errors. Added None guard and fixed dupe count math to use max(0, count - 1) instead of ternary that produced -1 dupes. Co-Authored-By: Claude Opus 4.6 (1M context) --- helpers/main.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/helpers/main.py b/helpers/main.py index 99ec420..ce585c4 100644 --- a/helpers/main.py +++ b/helpers/main.py @@ -181,11 +181,19 @@ async def get_card_embeds(card, include_stats=False) -> list: name="Collected By", value=f"{count} team{'s' if count != 1 else ''}" ) - if card['team']['lname'] != 'Paper Dynasty': - team_dex = await db_get('cards', params=[("player_id", card["player"]["player_id"]), ('team_id', card['team']['id'])]) - copy_count = team_dex['count'] if team_dex['count'] else 1 - dupe_count = copy_count - 1 - embed.add_field(name='Dupes', value=f'{dupe_count} dupe{"s" if dupe_count != 1 else ""}') + if card["team"]["lname"] != "Paper Dynasty": + team_dex = await db_get( + "cards", + params=[ + ("player_id", card["player"]["player_id"]), + ("team_id", card["team"]["id"]), + ], + ) + if team_dex is not None: + dupe_count = max(0, team_dex["count"] - 1) + embed.add_field( + name="Dupes", value=f"{dupe_count} dupe{'s' if dupe_count != 1 else ''}" + ) # embed.add_field(name='Team', value=f'{card["player"]["mlbclub"]}') if card["player"]["franchise"] != "Pokemon": -- 2.25.1