feat(moderation): case exports will now export as codeblocks instead of files if they are less than 1,800 characters in length
This commit is contained in:
parent
716e7a70f6
commit
ea9d8fb201
1 changed files with 10 additions and 6 deletions
|
@ -1124,6 +1124,7 @@ class Moderation(commands.Cog):
|
|||
case = await self.fetch_case(case_number, interaction.guild.id)
|
||||
if case:
|
||||
if export:
|
||||
if len(str(case)) > 1800:
|
||||
filename = str(data_manager.cog_data_path(cog_instance=self)) + str(os.sep) + f"moderation_{interaction.guild.id}_case_{case_number}.json"
|
||||
|
||||
with open(filename, "w", encoding="utf-8") as f:
|
||||
|
@ -1133,6 +1134,9 @@ class Moderation(commands.Cog):
|
|||
|
||||
os.remove(filename)
|
||||
return
|
||||
else:
|
||||
await interaction.response.send_message(content=f"```json\n{json.dumps(case, indent=2)}```", ephemeral=ephemeral)
|
||||
return
|
||||
if changes:
|
||||
embed = await self.embed_factory('changes', interaction=interaction, case_dict=case)
|
||||
else:
|
||||
|
|
Loading…
Reference in a new issue