Getting rid of the try except and re-wording some things

This commit is contained in:
Luke Robles 2023-06-16 15:16:22 -07:00
parent efdf6313b0
commit a1323e2ad3

View File

@ -220,13 +220,15 @@ async def calculate_trade_profies(commodity, scu=None):
)
response = requests.get(url, headers=headers).json()["data"]
if not response:
embed.set_author(name="❌ Couldnt find that commodity: %s" % commodity)
embed.set_author(name="❌ Couldnt find that commodity: %s\n\nDid you make a typo?" % commodity)
return embed
embed.set_author(name=commodity)
embed.set_thumbnail(
url="https://media.starcitizen.tools/thumb/b/bb/Shubin_logo_circle.png/120px-Shubin_logo_circle.png"
)
# Loop through every system/outpost and find the cheapest place selling the commodity
try:
costs = {}
for systems, stations in response.items():
for station, trades in stations.items():
@ -235,7 +237,7 @@ async def calculate_trade_profies(commodity, scu=None):
break
embed.add_field(
name="**Cheapest place to fill %s of %s**" % (scu_string, commodity),
name="**Best place to buy %s of %s**" % (scu_string, commodity),
value="%s: $%s"
% (
min(costs, key=costs.get),
@ -243,8 +245,6 @@ async def calculate_trade_profies(commodity, scu=None):
),
inline=True,
)
except Exception:
pass
# Same logic, but finding the place buying the commodity for the most
profits = {}
@ -255,7 +255,7 @@ async def calculate_trade_profies(commodity, scu=None):
break
embed.add_field(
name="Most profitable place to sell %s of %s" % (scu_string, commodity),
name="Best palce to sell %s of %s" % (scu_string, commodity),
value="%s: $%s"
% (
max(profits, key=profits.get),