From 0ca8f3d50b5db0ba90ace357d8eb200a95791d5d Mon Sep 17 00:00:00 2001 From: Luke Robles Date: Fri, 16 Jun 2023 08:05:59 -0700 Subject: [PATCH] fix issue if you typo a commodity name --- app/star_citizen.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/app/star_citizen.py b/app/star_citizen.py index 20cc099d..aacc32a7 100755 --- a/app/star_citizen.py +++ b/app/star_citizen.py @@ -218,11 +218,10 @@ async def calculate_trade_profies(commodity, scu=None): embed = discord.Embed( description="-------", color=discord.Color.blue(), type="rich" ) - try: - response = requests.get(url, headers=headers).json()["data"] - except Exception as e: - print(e) - embed.set_author(name="❌ Couldnt find that commodity") + response = requests.get(url, headers=headers).json()["data"] + if not response: + embed.set_author(name="❌ Couldnt find that commodity: %s" % commodity) + return embed embed.set_author(name=commodity)