Add length/width/height to /ship

This commit is contained in:
Luke Robles 2023-11-21 09:47:19 -08:00
parent b1773530e3
commit 45d0a83c06
2 changed files with 35 additions and 1 deletions

View File

@ -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,
)

View File

@ -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
)