From af9db8cc58927d035a2b13452d1873edbbb66d96 Mon Sep 17 00:00:00 2001 From: SeaswimmerTheFsh Date: Fri, 15 Dec 2023 10:35:55 -0500 Subject: [PATCH] fix(moderation): hopefully fixed exports not exporting as files --- moderation/moderation.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/moderation/moderation.py b/moderation/moderation.py index 8d33434..9f69434 100644 --- a/moderation/moderation.py +++ b/moderation/moderation.py @@ -1137,10 +1137,10 @@ class Moderation(commands.Cog): @app_commands.command(name="case") @app_commands.choices(export=[ - Choice(name="Export as File", value='file'), - Choice(name='Export as Codeblock', value='codeblock') + Choice(name="Export as File", value=1), + Choice(name='Export as Codeblock', value=2) ]) - async def case(self, interaction: discord.Interaction, case: int, ephemeral: bool = None, changes: bool = False, export: Choice[str] = None): + async def case(self, interaction: discord.Interaction, case: int, ephemeral: bool = None, changes: bool = False, export: Choice[int] = None): """Check the details of a specific case. Parameters @@ -1167,13 +1167,13 @@ class Moderation(commands.Cog): case_dict = await self.fetch_case(case, interaction.guild.id) if case_dict: if export: - if export == 'file' or len(str(case)) > 1800: + if export == 1 or len(str(case_dict)) > 1800: # If exporting as file or if case is too large to export as codeblock filename = str(data_manager.cog_data_path(cog_instance=self)) + str(os.sep) + f"moderation_{interaction.guild.id}_case_{case}.json" with open(filename, "w", encoding="utf-8") as f: json.dump(case_dict, f, indent=2) - if export == 'codeblock': + if export == 2: # If exporting as codeblock content = f"Case #{case} exported.\n*Case was too large to export as codeblock, so it has been uploaded as a `.json` file.*" else: content = f"Case #{case} exported."