forked from cswimr/SeaCogs
fix(aurora): fixed exporting moderation history
This commit is contained in:
parent
90e80d1018
commit
04101cfd1b
1 changed files with 7 additions and 2 deletions
|
@ -35,7 +35,7 @@ class Aurora(commands.Cog):
|
||||||
This cog stores all of its data in an SQLite database."""
|
This cog stores all of its data in an SQLite database."""
|
||||||
|
|
||||||
__author__ = "SeaswimmerTheFsh"
|
__author__ = "SeaswimmerTheFsh"
|
||||||
__version__ = "2.0.1"
|
__version__ = "2.0.2"
|
||||||
|
|
||||||
async def red_delete_data_for_user(self, *, requester, user_id: int):
|
async def red_delete_data_for_user(self, *, requester, user_id: int):
|
||||||
if requester == "discord_deleted_user":
|
if requester == "discord_deleted_user":
|
||||||
|
@ -585,11 +585,16 @@ class Aurora(commands.Cog):
|
||||||
|
|
||||||
results = cursor.fetchall()
|
results = cursor.fetchall()
|
||||||
|
|
||||||
|
cases = []
|
||||||
|
for result in results:
|
||||||
|
case = dict(result)
|
||||||
|
cases.append(case)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
filename = str(data_manager.cog_data_path(cog_instance=self)) + str(os.sep) + f"moderation_{interaction.guild.id}.json"
|
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:
|
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)
|
await interaction.followup.send(file=discord.File(filename, f"moderation_{interaction.guild.id}.json"), ephemeral=ephemeral)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue