async def _use_core(self, ctx, item:int, *args) -> None: """This passes the execution to the right class """ card_class = [c for c in Card.__subclasses__() if c.__name__ == f"Card{item}"][0] l = [] for p, (k, v) in enumerate([x for x in card_class.exec.__annotations__.items() if not str(x[0]) == "return"]): if len(args) > p and isinstance(args[p], v): l.append({k: args[p]}) else: l.append(None) if None in l: return await ctx.send(f"Invalid arguments provided! Usage: `{self.client.command_prefix(self.client, ctx.message)[2]}use {item} " + " ".join([f"[{k}: {v.__name__}]" for k, v in card_class.exec.__annotations__.items() if not str(k) == "return"]) + "`", allowed_mentions=discord.AllowedMentions.none()) kwargs = {k: v for d in l for k, v in d.items()} try: await card_class(ctx, card_id=item).exec(**kwargs) except Exception as e: await ctx.send(e.message, allowed_mentions=discord.AllowedMentions.none())
async def cardinfo(self, ctx, card:int): """Check card info out about any card you own""" try: c = Card(card) except CardNotFound: return await ctx.send("Invalid card") author = User(ctx.author.id) if not author.has_any_card(c.id): return await ctx.send("You don't own a copy of this card so you can't view it's infos") embed = c._get_analysis_embed(c.id) if c.type == "spell" and c.id not in [*DEF_SPELLS, *VIEW_DEF_SPELLS]: card_class = [c for c in Card.__subclasses__() if c.__name__ == f"Card{card}"][0] usage = f"`{self.client.command_prefix(self.client, ctx.message)[2]}use {card} " + " ".join([f"[{k}: {v.__name__}]" for k, v in card_class.exec.__annotations__.items() if not str(k) == "return"]) + "`" embed.add_field(name="Usage", value=usage, inline=False) await ctx.send(embed=embed)