CLAUDE: Handle Team Choice packs with no team/cardset assigned
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 <noreply@anthropic.com>
This commit is contained in:
parent
81373a9b42
commit
f7f37c9d95
@ -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]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user