diff --git a/app/cogs/markov.py b/app/cogs/markov.py index 56f1ce4f..9dff7b5f 100755 --- a/app/cogs/markov.py +++ b/app/cogs/markov.py @@ -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) ) diff --git a/app/cogs/palworld.py b/app/cogs/palworld.py index e7a2ea94..f05fe3ac 100755 --- a/app/cogs/palworld.py +++ b/app/cogs/palworld.py @@ -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): diff --git a/app/cogs/server_utils.py b/app/cogs/server_utils.py index e4fd424d..ca3a2ed2 100755 --- a/app/cogs/server_utils.py +++ b/app/cogs/server_utils.py @@ -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}") diff --git a/app/diff.py b/app/diff.py deleted file mode 100755 index 6384b8a5..00000000 --- a/app/diff.py +++ /dev/null @@ -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']}" - ) diff --git a/app/ffxiv.py b/app/ffxiv.py index 892eac11..12fac3ad 100755 --- a/app/ffxiv.py +++ b/app/ffxiv.py @@ -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 ) diff --git a/app/lewds.py b/app/lewds.py index ff1f69bc..cf6bbd75 100755 --- a/app/lewds.py +++ b/app/lewds.py @@ -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(): diff --git a/app/star_citizen.py b/app/star_citizen.py index 9f302fe8..072f1def 100755 --- a/app/star_citizen.py +++ b/app/star_citizen.py @@ -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