Add /lookup command & fix mvp choice pack

This commit is contained in:
Cal Corum 2023-10-24 23:44:42 -05:00
parent d15050242a
commit 8339eb63eb
2 changed files with 23 additions and 3 deletions

View File

@ -593,6 +593,8 @@ class Economy(commands.Cog):
p_group = f'Team Choice-Cardset-{pack["pack_cardset"]["id"]}-{pack["pack_cardset"]["name"]}' p_group = f'Team Choice-Cardset-{pack["pack_cardset"]["id"]}-{pack["pack_cardset"]["name"]}'
elif pack['pack_type']['name'] == 'All Star': elif pack['pack_type']['name'] == 'All Star':
p_group = f'All Star-Cardset-{pack["pack_cardset"]["id"]}-{pack["pack_cardset"]["name"]}' p_group = f'All Star-Cardset-{pack["pack_cardset"]["id"]}-{pack["pack_cardset"]["name"]}'
elif pack['pack_type']['name'] == 'All Star':
p_group = f'MVP-Cardset-{pack["pack_cardset"]["id"]}-{pack["pack_cardset"]["name"]}'
logging.debug(f'p_group: {p_group}') logging.debug(f'p_group: {p_group}')
if p_group is not None: if p_group is not None:

View File

@ -555,7 +555,9 @@ class Players(commands.Cog):
await interaction.edit_original_response(content=None, embed=embed) await interaction.edit_original_response(content=None, embed=embed)
@app_commands.command(name='card-lookup', description='Look up individual cards by ID') group_lookup = app_commands.Group(name='lookup', description='Search for cards or players by ID')
@group_lookup.command(name='card-id', description='Look up individual card by ID')
@app_commands.checks.has_any_role(PD_PLAYERS_ROLE_NAME) @app_commands.checks.has_any_role(PD_PLAYERS_ROLE_NAME)
async def card_lookup_command(self, interaction: discord.Interaction, card_id: int): async def card_lookup_command(self, interaction: discord.Interaction, card_id: int):
await interaction.response.defer() await interaction.response.defer()
@ -574,8 +576,24 @@ class Players(commands.Cog):
content=c_string, content=c_string,
embeds=await get_card_embeds(c_query) embeds=await get_card_embeds(c_query)
) )
else: return
await interaction.edit_original_response(content=f'No card found with id {card_id}')
await interaction.edit_original_response(content=f'There is no card with ID {card_id}')
@group_lookup.command(name='player-id', description='Look up an individual player by ID')
@app_commands.checks.has_any_role(PD_PLAYERS_ROLE_NAME)
async def player_lookup_command(self, interaction: discord.Interaction, player_id: int):
await interaction.response.defer()
p_query = await db_get('players', object_id=player_id)
if p_query:
p_card = get_blank_team_card(p_query)
await interaction.edit_original_response(
content=None,
embeds=await get_card_embeds(p_card)
)
return
await interaction.edit_original_response(content=f'There is no player with ID {player_id}.')
@commands.hybrid_command(name='branding-pd', help='Update your team branding') @commands.hybrid_command(name='branding-pd', help='Update your team branding')
@commands.has_any_role(PD_PLAYERS_ROLE_NAME) @commands.has_any_role(PD_PLAYERS_ROLE_NAME)