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 5e84edc81a
commit 9e5519c110

View File

@ -220,13 +220,15 @@ async def calculate_trade_profies(commodity, scu=None):
) )
response = requests.get(url, headers=headers).json()["data"] response = requests.get(url, headers=headers).json()["data"]
if not response: 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 return embed
embed.set_author(name=commodity) 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 # Loop through every system/outpost and find the cheapest place selling the commodity
try:
costs = {} costs = {}
for systems, stations in response.items(): for systems, stations in response.items():
for station, trades in stations.items(): for station, trades in stations.items():
@ -235,7 +237,7 @@ async def calculate_trade_profies(commodity, scu=None):
break break
embed.add_field( 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" value="%s: $%s"
% ( % (
min(costs, key=costs.get), min(costs, key=costs.get),
@ -243,8 +245,6 @@ async def calculate_trade_profies(commodity, scu=None):
), ),
inline=True, inline=True,
) )
except Exception:
pass
# Same logic, but finding the place buying the commodity for the most # Same logic, but finding the place buying the commodity for the most
profits = {} profits = {}
@ -255,7 +255,7 @@ async def calculate_trade_profies(commodity, scu=None):
break break
embed.add_field( 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" value="%s: $%s"
% ( % (
max(profits, key=profits.get), max(profits, key=profits.get),