From f7f37c9d958221b3cd4bf96a489ef4e319415df4 Mon Sep 17 00:00:00 2001 From: Cal Corum Date: Mon, 10 Nov 2025 15:09:26 -0600 Subject: [PATCH] CLAUDE: Handle Team Choice packs with no team/cardset assigned MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Users were receiving "This interaction failed" when trying to open Team Choice packs that had neither pack_team nor pack_cardset assigned in the database. The previous fix only handled packs WITH cardset but WITHOUT team. This adds handling for completely unconfigured Team Choice packs. Now shows a helpful error message: "This Team Choice pack needs to be assigned a team and cardset. Please contact an admin to configure this pack." This prevents the KeyError exception that was being thrown at helpers.py:1692 when open_choice_pack() received a pack with pack_team=None. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- discord_ui/selectors.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/discord_ui/selectors.py b/discord_ui/selectors.py index 1db2810..5dcfbe3 100644 --- a/discord_ui/selectors.py +++ b/discord_ui/selectors.py @@ -174,7 +174,15 @@ class SelectOpenPack(discord.ui.Select): await interaction.response.edit_message(view=None) cardset_id = None - if 'Team Choice' in pack_vals and 'Cardset' in pack_vals: + # Handle Team Choice packs with no team/cardset assigned + if 'Team Choice' in pack_vals and 'Team' not in pack_vals and 'Cardset' not in pack_vals: + await interaction.followup.send( + content='This Team Choice pack needs to be assigned a team and cardset. ' + 'Please contact an admin to configure this pack.', + ephemeral=True + ) + return + elif 'Team Choice' in pack_vals and 'Cardset' in pack_vals: # cardset_id = pack_vals[2] cardset_index = pack_vals.index('Cardset') cardset_id = pack_vals[cardset_index + 1]