From e72655d3dc535be0718c98b0dbd69b6019ae53e6 Mon Sep 17 00:00:00 2001 From: Cal Corum Date: Tue, 2 May 2023 12:02:21 -0500 Subject: [PATCH] Update players.py card-lookup command --- cogs/players.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/cogs/players.py b/cogs/players.py index af46679..b81a7d0 100644 --- a/cogs/players.py +++ b/cogs/players.py @@ -495,6 +495,24 @@ class Players(commands.Cog): await interaction.edit_original_response(content=None, embed=embed) + @app_commands.command(name='card-lookup', description='Look up individual cards by ID') + @app_commands.checks.has_any_role(PD_PLAYERS_ROLE_NAME) + async def card_lookup_command(self, interaction: discord.Interaction, card_id: int): + await interaction.response.defer() + c_query = db_get('cards', object_id=card_id) + if c_query: + c_string = f'Card ID {card_id} is a {c_query["player"]["description"]} owned by the ' \ + f'{c_query["team"]["sname"]}' + if c_query["pack"] is not None: + c_string += f' pulled from a {c_query["pack"]["pack_type"]["name"]} pack.' + + await interaction.edit_original_response( + content=c_string, + embeds=await get_card_embeds(c_query) + ) + else: + await interaction.edit_original_response(content=f'No card found with id {card_id}') + @commands.hybrid_command(name='branding-pd', help='Update your team branding') @commands.has_any_role(PD_PLAYERS_ROLE_NAME) @commands.check(legal_channel)