From 532f8e6841b7c1179e1eb91ac58918d7614d14ba Mon Sep 17 00:00:00 2001 From: Luke Robles Date: Thu, 30 Nov 2023 08:10:06 -0800 Subject: [PATCH] Add ship health to /ship command --- app/bot.py | 0 app/star_citizen.py | 11 +++++++++++ 2 files changed, 11 insertions(+) mode change 100644 => 100755 app/bot.py diff --git a/app/bot.py b/app/bot.py old mode 100644 new mode 100755 diff --git a/app/star_citizen.py b/app/star_citizen.py index 7f537584..82f3027a 100644 --- a/app/star_citizen.py +++ b/app/star_citizen.py @@ -192,6 +192,17 @@ async def get_ship(ship_name): cargo_capacity = "N/A" embed.add_field(name="**Cargo Capacity**", value=cargo_capacity, inline=True) + try: + health = ( + soup.find("div", {"class": "infobox__label"}, string="Health") + .findNext("div", {"class": "infobox__data"}) + .text + ) + except Exception: + health = "N/A" + + embed.add_field(name="**Ship Health**", value=health, inline=True) + try: top_speed = ( soup.find("div", {"class": "infobox__label"}, string="Max speed")