From d62e67410698a0da136b70c6a2118cee448881dc Mon Sep 17 00:00:00 2001 From: Luke Robles Date: Thu, 1 Jun 2023 17:13:47 -0700 Subject: [PATCH] Adding top speed to /ship command --- app/star_citizen.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/star_citizen.py b/app/star_citizen.py index ebe50e78..b28ad83e 100644 --- a/app/star_citizen.py +++ b/app/star_citizen.py @@ -116,9 +116,19 @@ async def get_ship(ship_name): ) except Exception: cargo_capacity = "N/A" - embed.add_field(name="**Cargo Capacity**", value=cargo_capacity, inline=True) + try: + top_speed = ( + soup.find("div", {"class": "infobox__label"}, string="Max speed") + .findNext("span", {"class": "smwtext"}) + .text + ) + except Exception: + top_speed = "N/A" + + embed.add_field(name="**Top Speed**", value=top_speed, inline=True) + try: crew_size = ( soup.find("div", {"class": "infobox__label"}, string="Crew")