more fstrings
All checks were successful
Build and push / changes (push) Successful in 2s
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 2s

This commit is contained in:
Luke Robles 2025-05-07 15:39:50 -07:00
parent befad4d283
commit e6c6bd5627
7 changed files with 19 additions and 51 deletions

View File

@ -17,7 +17,9 @@ class Markov(commands.Cog):
@option("User", description="Choose a member", input_type="user")
async def markov(self, ctx: discord.ApplicationContext, user: discord.Member):
await ctx.defer()
temp_message = await ctx.followup.send("Just a moment, generating autism")
temp_message = await ctx.respond(
f"Generating a markov chain for {user.mention}..."
)
# Get messages from passed in user
authors_mesages = []
@ -33,7 +35,7 @@ class Markov(commands.Cog):
for i in range(random.randint(3, 9)):
dummy.append(str(user_model.make_sentence(max_words=100, tries=900)))
await temp_message.edit(
"Heres a markov chain based on %s's shitposts" % user.mention
f"Heres a markov chain based on {user.mention}'s shitposts"
+ "\n\n"
+ " ".join(dummy)
)

View File

@ -216,7 +216,7 @@ class PalWorld(commands.Cog):
# if str(num_players) in channel.name.split("/")[0]:
# return
# await channel.edit(name="Palworlders (%s/16 online)" % num_players)
# await channel.edit(name=f"Palworlders ({num_players}/16 online)")
def setup(bot):

View File

@ -73,13 +73,13 @@ class ServerUtils(commands.Cog):
await ctx.send_followup(
embed=core_utils.generate_embed(
embed_title="New emoji: %s" % emoji_name,
embed_title=f"New emoji: {emoji_name}",
embed_description=emoji_id,
)
)
except Exception as e:
await ctx.respond(
"I wasnt able to upload that image as an emoji. Sorry\n\nError: %s" % e
f"I wasnt able to upload that image as an emoji. Sorry\n\nError: {e}"
)
os.remove(emoji_staging)
return
@ -171,7 +171,7 @@ class ServerUtils(commands.Cog):
)
embed.add_field(
name="Other servers using %s" % self.bot.user.name,
value="\n".join("[%s](%s)" % (x.name, x.jump_url) for x in self.bot.guilds),
value="\n".join(f"[{x.name}]({x.jump_url})" for x in self.bot.guilds),
)
if server.banner:
embed.set_image(url=f"{server.banner}")

View File

@ -1,27 +0,0 @@
import json
from deepdiff import DeepDiff
with open("/tmp/boss_spawns.json", "r") as f:
old_spawns = json.load(f)
with open("/tmp/spawn.json", "r") as f:
new_spawns = json.load(f)
diff = DeepDiff(old_spawns, new_spawns, ignore_order=True, verbose_level=2)
# Get the differences between the two JSON blobs
# Iterate through the diff to find spawnChance differences
for key, changes in diff.items():
if key == "values_changed":
for path, change in changes.items():
# Access the level and boss name directly from the path
level, boss = (
path.split("[")[1].split("]")[0],
path.split("[")[2].split("]")[0],
)
# Print the relevant difference in spawnChance
if "new_value" in change:
print(
f"Level: {level}, Boss: {boss}, Diff in spawnChance: {change['old_value']} -> {change['new_value']}"
)

View File

@ -32,7 +32,7 @@ def make_request(name, server):
current_class_name = current_class["Job"]["Name"]
current_class_level = character["ActiveClassJob"]["Level"]
xp_to_level_up = current_class["ExpLevelTogo"]
job_icon = "https://xivapi.com/%s" % current_class["Job"]["Icon"]
job_icon = f"https://xivapi.com/{current_class['Job']['Icon']}"
if character["GrandCompany"]["Company"]:
grand_company = character["GrandCompany"]
@ -49,14 +49,13 @@ def make_request(name, server):
embed = discord.Embed(description=character["Name"], color=0x428BCA, type="rich")
embed.set_author(
name="FFXIV API bullshit for %s\nPlayer ID: %s"
% (character["Name"], character["ID"]),
name=f"FFXIV API bullshit for {character['Name']}\nPlayer ID: {character['ID']}",
icon_url="http://na.lodestonenews.com/images/thumbnail.png",
)
embed.set_thumbnail(url=job_icon)
embed.add_field(
name="Current Class",
value="%s - Lvl: %s" % (current_class_name, current_class_level),
value=f"{current_class_name} - Lvl: {current_class_level}",
inline=True,
)
embed.add_field(name="XP to level up", value=xp_to_level_up, inline=True)
@ -64,8 +63,7 @@ def make_request(name, server):
if character["GrandCompany"]["Company"]:
embed.add_field(
name="Grand Company",
value="%s of the %s"
% (grand_company["Rank"]["Name"], grand_company["Company"]["Name"]),
value=f"{grand_company['Rank']['Name']} of the {grand_company['Company']['Name']}",
inline=False,
)
else:
@ -74,9 +72,8 @@ def make_request(name, server):
)
if player_blob["FreeCompany"]:
embed.add_field(
name="Free Company: %s (%s)" % (fc_name, fc_tag),
value="\nActive Members: %s\nFC Rank: %s\nFC Estate: %s"
% (fc_member_count, fc_rank, fc_plot),
name=f"Free Company: {fc_name} ({fc_tag})",
value=f"\nActive Members: {fc_member_count}\nFC Rank: {fc_rank}\nFC Estate: {fc_plot}",
inline=False,
)
else:
@ -88,7 +85,7 @@ def make_request(name, server):
embed.add_field(name="All other classes", value="-----", inline=False)
all_classes = character["ClassJobs"]
for job in all_classes:
job_icon = "https://xivapi.com%s" % job["Job"]["Icon"]
job_icon = f"https://xivapi.com{job['Job']['Icon']}"
embed.add_field(
name=job["Job"]["Abbreviation"], value=job["Level"], inline=True
)

View File

@ -21,10 +21,10 @@ def get_from_danbooru(boards, nsfw=True):
if not set(request["tag_string"].split()).isdisjoint(undesired_tags):
return get_from_danbooru(boards)
# Return the large firl url if available
# Return the large file url if available
if "large_file_url" in request.keys():
if request["large_file_url"].startswith("/data/"):
return "https://danbooru.donmai.us{}".format(request["large_file_url"])
return f"https://danbooru.donmai.us{request['large_file_url']}"
return request["large_file_url"]
if "file_url" in request.keys():

View File

@ -482,12 +482,8 @@ async def calculate_trade_profits(commodity, scu=None):
value=f"¤{investment:20,.2f} aUEC",
inline=False,
)
embed.add_field(
name="Total Profit", value=f"¤{profit:20,.2f} aUEC", inline=True
)
embed.add_field(
name="Margin", value=f"¤{margin:20,.2f} aUEC/scu", inline=True
)
embed.add_field(name="Total Profit", value=f"¤{profit:20,.2f} aUEC", inline=True)
embed.add_field(name="Margin", value=f"¤{margin:20,.2f} aUEC/scu", inline=True)
return embed