From 45d0a83c06989a2bb5938d2bc727e8151782dad2 Mon Sep 17 00:00:00 2001 From: Luke Robles Date: Tue, 21 Nov 2023 09:47:19 -0800 Subject: [PATCH] Add length/width/height to /ship --- app/cogs/star_citizen.py | 2 +- app/star_citizen.py | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/app/cogs/star_citizen.py b/app/cogs/star_citizen.py index 0c72e6ed..00b22398 100644 --- a/app/cogs/star_citizen.py +++ b/app/cogs/star_citizen.py @@ -59,7 +59,7 @@ class StarCitizen(commands.Cog): for k, v in sorted_dict.items(): embed.add_field( name=k, - value="${:20,}".format(v), + value=f"${v:,}", inline=False, ) diff --git a/app/star_citizen.py b/app/star_citizen.py index aab61b49..743c933a 100755 --- a/app/star_citizen.py +++ b/app/star_citizen.py @@ -227,6 +227,40 @@ async def get_ship(ship_name): embed.add_field(name="**Expedite Fee**", value=expedite_fee, inline=True) + embed.add_field(name="-------", value="", inline=False) + try: + length = ( + soup.find("div", {"class": "infobox__label"}, string="Length") + .findNext("span", {"class": "smwtext"}) + .text + ) + except Exception: + length = "N/A" + + embed.add_field(name="**Length**", value=length, inline=True) + + try: + width = ( + soup.find("div", {"class": "infobox__label"}, string="Width") + .findNext("span", {"class": "smwtext"}) + .text + ) + except Exception: + width = "N/A" + + embed.add_field(name="**Width**", value=width, inline=True) + + try: + height = ( + soup.find("div", {"class": "infobox__label"}, string="Height") + .findNext("span", {"class": "smwtext"}) + .text + ) + except Exception: + height = "N/A" + + embed.add_field(name="**Height**", value=height, inline=True) + embed.add_field( name="**Link**", value="%s%s" % (wiki_url, wiki_ship_name), inline=False )