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):
|
async def rsi_find(player):
|
||||||
base_url = "https://robertsspaceindustries.com"
|
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
|
response = requests.get(profile_url).text
|
||||||
|
|
||||||
if "NAVIGATING UNCHARTED TERRITORY" in response:
|
if "NAVIGATING UNCHARTED TERRITORY" in response:
|
||||||
@ -18,7 +18,7 @@ async def rsi_find(player):
|
|||||||
description="❌❌❌",
|
description="❌❌❌",
|
||||||
color=discord.Color.red(),
|
color=discord.Color.red(),
|
||||||
type="rich",
|
type="rich",
|
||||||
title="Player %s does not exist" % player,
|
title=f"Player {player} does not exist",
|
||||||
)
|
)
|
||||||
return embed
|
return embed
|
||||||
|
|
||||||
@ -65,7 +65,7 @@ async def rsi_find(player):
|
|||||||
description="-------",
|
description="-------",
|
||||||
color=discord.Color.blue(),
|
color=discord.Color.blue(),
|
||||||
type="rich",
|
type="rich",
|
||||||
title="%s's Star citizen information" % player,
|
title=f"{player}'s Star citizen information",
|
||||||
)
|
)
|
||||||
|
|
||||||
embed.add_field(
|
embed.add_field(
|
||||||
@ -141,7 +141,7 @@ async def rsi_find(player):
|
|||||||
embed.add_field(name="-------", value="", inline=False)
|
embed.add_field(name="-------", value="", inline=False)
|
||||||
embed.add_field(
|
embed.add_field(
|
||||||
name="Org Name",
|
name="Org Name",
|
||||||
value="[%s (%s)](%s)" % (org_name, org_abbreviation, org_url),
|
value=f"[{org_name} ({org_abbreviation})]({org_url})",
|
||||||
inline=True,
|
inline=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -167,7 +167,7 @@ async def get_ship(ship_name):
|
|||||||
headers = {
|
headers = {
|
||||||
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:109.0) Gecko/20100101 Firefox/112.0"
|
"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")
|
soup = BeautifulSoup(response, "html.parser")
|
||||||
|
|
||||||
embed = discord.Embed(
|
embed = discord.Embed(
|
||||||
@ -182,7 +182,7 @@ async def get_ship(ship_name):
|
|||||||
)
|
)
|
||||||
except Exception:
|
except Exception:
|
||||||
item_uuid = "N/A"
|
item_uuid = "N/A"
|
||||||
embed.set_footer(text="item UUID: %s" % item_uuid)
|
embed.set_footer(text=f"item UUID: {item_uuid}")
|
||||||
|
|
||||||
# try:
|
# try:
|
||||||
# description = (
|
# description = (
|
||||||
@ -212,8 +212,8 @@ async def get_ship(ship_name):
|
|||||||
)
|
)
|
||||||
|
|
||||||
embed.set_author(
|
embed.set_author(
|
||||||
name="%s %s" % (manufacturer, ship_name_on_page),
|
name=f"{manufacturer} {ship_name_on_page}",
|
||||||
url="%s%s" % (wiki_url, wiki_ship_name),
|
url=f"{wiki_url}{wiki_ship_name}",
|
||||||
)
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -229,7 +229,7 @@ async def get_ship(ship_name):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
ingame_price = requests.get(
|
ingame_price = requests.get(
|
||||||
"https://finder.cstone.space/ShipShops1/%s" % item_uuid
|
f"https://finder.cstone.space/ShipShops1/{item_uuid}"
|
||||||
).text
|
).text
|
||||||
price_soup = BeautifulSoup(ingame_price, "html.parser")
|
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(" ", ",")
|
second_row.find_all("td")[1].get_text(strip=True).replace(" ", ",")
|
||||||
)
|
)
|
||||||
|
|
||||||
price = "[%s](https://finder.cstone.space/ShipShops1/%s)" % (
|
price = f"[{ingame_price}](https://finder.cstone.space/ShipShops1/{item_uuid})"
|
||||||
ingame_price,
|
|
||||||
item_uuid,
|
|
||||||
)
|
|
||||||
|
|
||||||
if "Not available" in ingame_price:
|
if "Not available" in ingame_price:
|
||||||
price = "N/A"
|
price = "N/A"
|
||||||
@ -276,7 +273,7 @@ async def get_ship(ship_name):
|
|||||||
|
|
||||||
embed.add_field(
|
embed.add_field(
|
||||||
name="**Pledge Price**",
|
name="**Pledge Price**",
|
||||||
value="[%s](%s#buying-options)" % (pledge_price, pledge_store_link),
|
value=f"[{pledge_price}]({pledge_store_link}#buying-options)",
|
||||||
inline=True,
|
inline=True,
|
||||||
)
|
)
|
||||||
except Exception:
|
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=f"**{dimension}**", value=value, inline=True)
|
||||||
|
|
||||||
embed.add_field(
|
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:
|
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 = discord.Embed(description="❌", color=discord.Color.red(), type="rich")
|
||||||
embed.add_field(
|
embed.add_field(
|
||||||
name="**Could not find that ship**",
|
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)"
|
value=f"You gave me {ship_name}. Did you spell it right?\n\n(Its also possible my shitty code isnt working)",
|
||||||
% ship_name,
|
|
||||||
inline=True,
|
inline=True,
|
||||||
)
|
)
|
||||||
return embed
|
return embed
|
||||||
@ -448,7 +444,7 @@ async def calculate_trade_profits(commodity, scu=None):
|
|||||||
|
|
||||||
headers = {"api_key": os.getenv("uexcorp_key")}
|
headers = {"api_key": os.getenv("uexcorp_key")}
|
||||||
|
|
||||||
scu_string = "%s scu" % scu
|
scu_string = f"{scu} scu"
|
||||||
if not scu:
|
if not scu:
|
||||||
scu = 696
|
scu = 696
|
||||||
scu_string = "a C2 Hercules full"
|
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"]
|
best_sell_place = response["destination_terminal_name"]
|
||||||
|
|
||||||
embed.add_field(
|
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,
|
value=best_buy_place,
|
||||||
inline=True,
|
inline=True,
|
||||||
)
|
)
|
||||||
embed.add_field(
|
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,
|
value=best_sell_place,
|
||||||
inline=False,
|
inline=False,
|
||||||
)
|
)
|
||||||
|
|
||||||
embed.add_field(
|
embed.add_field(
|
||||||
name="Initial Investment",
|
name="Initial Investment",
|
||||||
value="¤{:20,.2f} aUEC".format(investment),
|
value=f"¤{investment:20,.2f} aUEC",
|
||||||
inline=False,
|
inline=False,
|
||||||
)
|
)
|
||||||
embed.add_field(
|
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(
|
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
|
return embed
|
||||||
|
|
||||||
@ -509,7 +505,7 @@ async def get_price(commodity, scu):
|
|||||||
|
|
||||||
headers = {"api_key": os.getenv("uexcorp_key")}
|
headers = {"api_key": os.getenv("uexcorp_key")}
|
||||||
|
|
||||||
scu_string = "%s scu" % scu
|
scu_string = f"{scu} scu"
|
||||||
|
|
||||||
embed = discord.Embed(
|
embed = discord.Embed(
|
||||||
description="-------", color=discord.Color.blue(), type="rich"
|
description="-------", color=discord.Color.blue(), type="rich"
|
||||||
@ -529,12 +525,8 @@ async def get_price(commodity, scu):
|
|||||||
break
|
break
|
||||||
|
|
||||||
embed.add_field(
|
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="%s: ¤%s"
|
value=f"{max(profits, key=profits.get)}: ¤{profits[max(profits, key=profits.get)]:20,.2f}".strip(),
|
||||||
% (
|
|
||||||
max(profits, key=profits.get),
|
|
||||||
"{:20,.2f}".format(profits[max(profits, key=profits.get)]).strip(),
|
|
||||||
),
|
|
||||||
inline=True,
|
inline=True,
|
||||||
)
|
)
|
||||||
return embed
|
return embed
|
||||||
|
Loading…
x
Reference in New Issue
Block a user