fix(aurora): fixed exporting moderation history

This commit is contained in:
Seaswimmer 2024-01-12 07:07:24 +00:00
parent 90e80d1018
commit 04101cfd1b
Signed by untrusted user: cswimr
GPG key ID: D74DDDDF420E13DF

View file

@ -35,7 +35,7 @@ class Aurora(commands.Cog):
This cog stores all of its data in an SQLite database."""
__author__ = "SeaswimmerTheFsh"
__version__ = "2.0.1"
__version__ = "2.0.2"
async def red_delete_data_for_user(self, *, requester, user_id: int):
if requester == "discord_deleted_user":
@ -585,11 +585,16 @@ class Aurora(commands.Cog):
results = cursor.fetchall()
cases = []
for result in results:
case = dict(result)
cases.append(case)
try:
filename = str(data_manager.cog_data_path(cog_instance=self)) + str(os.sep) + f"moderation_{interaction.guild.id}.json"
with open(filename, "w", encoding="utf-8") as f:
json.dump(results, f, indent=2)
json.dump(cases, f, indent=2)
await interaction.followup.send(file=discord.File(filename, f"moderation_{interaction.guild.id}.json"), ephemeral=ephemeral)