Converting star citizen file to use fstrings
All checks were successful
Build and push / changes (push) Successful in 3s
Build and push / Lint-Python (push) Successful in 1s
Build and push / Build-and-Push-Docker (push) Successful in 13s
Build and push / sync-argocd-app (push) Successful in 2s
Build and push / post-failure-to-discord (push) Has been skipped
Build and push / post-success-to-discord (push) Successful in 1s
All checks were successful
Build and push / changes (push) Successful in 3s
Build and push / Lint-Python (push) Successful in 1s
Build and push / Build-and-Push-Docker (push) Successful in 13s
Build and push / sync-argocd-app (push) Successful in 2s
Build and push / post-failure-to-discord (push) Has been skipped
Build and push / post-success-to-discord (push) Successful in 1s
This commit is contained in:
parent
99776dbae6
commit
befad4d283
@ -10,7 +10,7 @@ wiki_url = "https://starcitizen.tools/"
|
||||
async def rsi_find(player):
|
||||
base_url = "https://robertsspaceindustries.com"
|
||||
|
||||
profile_url = "%s/citizens/%s" % (base_url, player)
|
||||
profile_url = f"{base_url}/citizens/{player}"
|
||||
response = requests.get(profile_url).text
|
||||
|
||||
if "NAVIGATING UNCHARTED TERRITORY" in response:
|
||||
@ -18,7 +18,7 @@ async def rsi_find(player):
|
||||
description="❌❌❌",
|
||||
color=discord.Color.red(),
|
||||
type="rich",
|
||||
title="Player %s does not exist" % player,
|
||||
title=f"Player {player} does not exist",
|
||||
)
|
||||
return embed
|
||||
|
||||
@ -65,7 +65,7 @@ async def rsi_find(player):
|
||||
description="-------",
|
||||
color=discord.Color.blue(),
|
||||
type="rich",
|
||||
title="%s's Star citizen information" % player,
|
||||
title=f"{player}'s Star citizen information",
|
||||
)
|
||||
|
||||
embed.add_field(
|
||||
@ -141,7 +141,7 @@ async def rsi_find(player):
|
||||
embed.add_field(name="-------", value="", inline=False)
|
||||
embed.add_field(
|
||||
name="Org Name",
|
||||
value="[%s (%s)](%s)" % (org_name, org_abbreviation, org_url),
|
||||
value=f"[{org_name} ({org_abbreviation})]({org_url})",
|
||||
inline=True,
|
||||
)
|
||||
|
||||
@ -167,7 +167,7 @@ async def get_ship(ship_name):
|
||||
headers = {
|
||||
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:109.0) Gecko/20100101 Firefox/112.0"
|
||||
}
|
||||
response = requests.get(wiki_url + wiki_ship_name, headers=headers).text
|
||||
response = requests.get(f"{wiki_url}{wiki_ship_name}", headers=headers).text
|
||||
soup = BeautifulSoup(response, "html.parser")
|
||||
|
||||
embed = discord.Embed(
|
||||
@ -182,7 +182,7 @@ async def get_ship(ship_name):
|
||||
)
|
||||
except Exception:
|
||||
item_uuid = "N/A"
|
||||
embed.set_footer(text="item UUID: %s" % item_uuid)
|
||||
embed.set_footer(text=f"item UUID: {item_uuid}")
|
||||
|
||||
# try:
|
||||
# description = (
|
||||
@ -212,8 +212,8 @@ async def get_ship(ship_name):
|
||||
)
|
||||
|
||||
embed.set_author(
|
||||
name="%s %s" % (manufacturer, ship_name_on_page),
|
||||
url="%s%s" % (wiki_url, wiki_ship_name),
|
||||
name=f"{manufacturer} {ship_name_on_page}",
|
||||
url=f"{wiki_url}{wiki_ship_name}",
|
||||
)
|
||||
|
||||
try:
|
||||
@ -229,7 +229,7 @@ async def get_ship(ship_name):
|
||||
|
||||
try:
|
||||
ingame_price = requests.get(
|
||||
"https://finder.cstone.space/ShipShops1/%s" % item_uuid
|
||||
f"https://finder.cstone.space/ShipShops1/{item_uuid}"
|
||||
).text
|
||||
price_soup = BeautifulSoup(ingame_price, "html.parser")
|
||||
|
||||
@ -244,10 +244,7 @@ async def get_ship(ship_name):
|
||||
second_row.find_all("td")[1].get_text(strip=True).replace(" ", ",")
|
||||
)
|
||||
|
||||
price = "[%s](https://finder.cstone.space/ShipShops1/%s)" % (
|
||||
ingame_price,
|
||||
item_uuid,
|
||||
)
|
||||
price = f"[{ingame_price}](https://finder.cstone.space/ShipShops1/{item_uuid})"
|
||||
|
||||
if "Not available" in ingame_price:
|
||||
price = "N/A"
|
||||
@ -276,7 +273,7 @@ async def get_ship(ship_name):
|
||||
|
||||
embed.add_field(
|
||||
name="**Pledge Price**",
|
||||
value="[%s](%s#buying-options)" % (pledge_price, pledge_store_link),
|
||||
value=f"[{pledge_price}]({pledge_store_link}#buying-options)",
|
||||
inline=True,
|
||||
)
|
||||
except Exception:
|
||||
@ -426,7 +423,7 @@ async def get_ship(ship_name):
|
||||
embed.add_field(name=f"**{dimension}**", value=value, inline=True)
|
||||
|
||||
embed.add_field(
|
||||
name="**Link**", value="%s%s" % (wiki_url, wiki_ship_name), inline=False
|
||||
name="**Link**", value=f"{wiki_url}{wiki_ship_name}", inline=False
|
||||
)
|
||||
|
||||
except Exception as e:
|
||||
@ -434,8 +431,7 @@ async def get_ship(ship_name):
|
||||
embed = discord.Embed(description="❌", color=discord.Color.red(), type="rich")
|
||||
embed.add_field(
|
||||
name="**Could not find that ship**",
|
||||
value="You gave me %s. Did you spell it right?\n\n(Its also possible my shitty code isnt working)"
|
||||
% ship_name,
|
||||
value=f"You gave me {ship_name}. Did you spell it right?\n\n(Its also possible my shitty code isnt working)",
|
||||
inline=True,
|
||||
)
|
||||
return embed
|
||||
@ -448,7 +444,7 @@ async def calculate_trade_profits(commodity, scu=None):
|
||||
|
||||
headers = {"api_key": os.getenv("uexcorp_key")}
|
||||
|
||||
scu_string = "%s scu" % scu
|
||||
scu_string = f"{scu} scu"
|
||||
if not scu:
|
||||
scu = 696
|
||||
scu_string = "a C2 Hercules full"
|
||||
@ -471,26 +467,26 @@ async def calculate_trade_profits(commodity, scu=None):
|
||||
best_sell_place = response["destination_terminal_name"]
|
||||
|
||||
embed.add_field(
|
||||
name="Best place to buy %s of %s" % (scu_string, commodity),
|
||||
name=f"Best place to buy {scu_string} of {commodity}",
|
||||
value=best_buy_place,
|
||||
inline=True,
|
||||
)
|
||||
embed.add_field(
|
||||
name="Best place to sell %s of %s" % (scu_string, commodity),
|
||||
name=f"Best place to sell {scu_string} of {commodity}",
|
||||
value=best_sell_place,
|
||||
inline=False,
|
||||
)
|
||||
|
||||
embed.add_field(
|
||||
name="Initial Investment",
|
||||
value="¤{:20,.2f} aUEC".format(investment),
|
||||
value=f"¤{investment:20,.2f} aUEC",
|
||||
inline=False,
|
||||
)
|
||||
embed.add_field(
|
||||
name="Total Profit", value="¤{:20,.2f} aUEC".format(profit), inline=True
|
||||
name="Total Profit", value=f"¤{profit:20,.2f} aUEC", inline=True
|
||||
)
|
||||
embed.add_field(
|
||||
name="Margin", value="¤{:20,.2f} aUEC/scu".format(margin), inline=True
|
||||
name="Margin", value=f"¤{margin:20,.2f} aUEC/scu", inline=True
|
||||
)
|
||||
return embed
|
||||
|
||||
@ -509,7 +505,7 @@ async def get_price(commodity, scu):
|
||||
|
||||
headers = {"api_key": os.getenv("uexcorp_key")}
|
||||
|
||||
scu_string = "%s scu" % scu
|
||||
scu_string = f"{scu} scu"
|
||||
|
||||
embed = discord.Embed(
|
||||
description="-------", color=discord.Color.blue(), type="rich"
|
||||
@ -529,12 +525,8 @@ async def get_price(commodity, scu):
|
||||
break
|
||||
|
||||
embed.add_field(
|
||||
name="Best place to sell %s of %s" % (scu_string, commodity),
|
||||
value="%s: ¤%s"
|
||||
% (
|
||||
max(profits, key=profits.get),
|
||||
"{:20,.2f}".format(profits[max(profits, key=profits.get)]).strip(),
|
||||
),
|
||||
name=f"Best place to sell {scu_string} of {commodity}",
|
||||
value=f"{max(profits, key=profits.get)}: ¤{profits[max(profits, key=profits.get)]:20,.2f}".strip(),
|
||||
inline=True,
|
||||
)
|
||||
return embed
|
||||
|
Loading…
x
Reference in New Issue
Block a user