diff --git a/tiamat/tiamat.py b/tiamat/tiamat.py index 5075732..a935320 100644 --- a/tiamat/tiamat.py +++ b/tiamat/tiamat.py @@ -17,7 +17,7 @@ class Tiamat(commands.Cog): f"is in the System Reference Document") else: initial_embed = discord.Embed(title=data["name"]) - initial_embed.add_field(name="HP", value=data["hp"]) + initial_embed.add_field(name="HP", value=data["hit_points"]) initial_embed.add_field(name="AC", value=data["armor_class"]) for ability in ["strength", "dexterity", "constitution", "intelligence", "wisdom", "charisma"]: initial_embed.add_field(name=ability, value=data[ability], inline=True) @@ -55,3 +55,24 @@ class Tiamat(commands.Cog): embed.add_field(name="Classes", value=', '.join(i["name"] for i in data["classes"]), inline=False) embed.add_field(name="Subclasses", value=', '.join(i["name"] for i in data["subclasses"]), inline=False) await ctx.send(embed=embed) + + @commands.command() + async def armour(self, ctx, *args): + name = '-'.join(args).lower().replace("-armor", "").replace("-armour", "") + data = requests.get(f"https://www.dnd5eapi.co/api/equipment/{name}").json() + if "error" in data: + await ctx.send(f"{' '.join(args)} not found, check that the name is spelled right and that the spell " + f"is in the System Reference Document") + try: + embed = discord.Embed(title=data["name"]) + embed.add_field(name="Category", value=data["armor_category"], inline=False) + embed.add_field(name="Base", value=data["armor_class"]["base"], inline=True) + if data["armor_class"]["max_bonus"] is not None: + embed.add_field(name="Max Dex Bonus", value=data["armor_class"]["max_bonus"], inline=True) + embed.add_field(name="Cost", value=f"""{data["cost"]["quantity"]} {data["cost"]["unit"]}""", inline=True) + embed.add_field(name="Strength Minimum", value=data["str_minimum"], inline=True) + embed.add_field(name="Stealth Disadvantage", value=data["stealth_disadvantage"], inline=True) + embed.add_field(name="Weight", value=data["weight"], inline=True) + await ctx.send(embed=embed) + except KeyError: + await ctx.send("Error: item is not armour")