diff --git a/tiamat/tiamat.py b/tiamat/tiamat.py index a935320..a899331 100644 --- a/tiamat/tiamat.py +++ b/tiamat/tiamat.py @@ -69,10 +69,35 @@ class Tiamat(commands.Cog): 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="Cost", value=f"""{data["cost"]["quantity"]} {data["cost"]["unit"]}""", inline=False) 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") + + @commands.command() + async def weapon(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["weapon_category"], inline=False) + embed.add_field(name="Range", value=data["weapon_range"], inline=True) + embed.add_field(name="Damage", value=f'{data["damage"]["damage_dice"]} ' + + f'{data["damage"]["damage_type"]["name"]}', inline=True) + if "two_handed_damage" in data: + embed.add_field(name="Two Handed Damage", value=data["two_handed_damage"]["damage_dice"], inline=True) + embed.add_field(name="Properties", value=', '.join(i["name"] for i in data["properties"]), inline=False) + if data["weapon_range"] != "Melee": + embed.add_field(name="Normal Range", value=data["range"]["normal"], inline=True) + embed.add_field(name="Long Range", value=data["range"]["Long"], inline=True) + embed.add_field(name="Cost", value=f"""{data["cost"]["quantity"]} {data["cost"]["unit"]}""", inline=False) + embed.add_field(name="Weight", value=data["weight"], inline=False) + await ctx.send(embed=embed) + except KeyError: + await ctx.send("Error: item is not a weapon")