WIP: Refactor Aurora (3.0.0) #29
1 changed files with 3 additions and 17 deletions
|
@ -1083,21 +1083,6 @@ class Aurora(commands.Cog):
|
|||
database = connect()
|
||||
|
||||
if export:
|
||||
database.row_factory = sqlite3.Row
|
||||
cursor = database.cursor()
|
||||
|
||||
query = f"""SELECT *
|
||||
FROM moderation_{interaction.guild.id}
|
||||
ORDER BY moderation_id DESC;"""
|
||||
cursor.execute(query)
|
||||
|
||||
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))
|
||||
|
@ -1105,8 +1090,10 @@ class Aurora(commands.Cog):
|
|||
+ f"moderation_{interaction.guild.id}.json"
|
||||
)
|
||||
|
||||
cases = Moderation.from_sql_all(interaction.client, interaction.guild.id)
|
||||
|
||||
with open(filename, "w", encoding="utf-8") as f:
|
||||
dump(cases, f, indent=2)
|
||||
dump(obj=cases, fp=f, indent=2)
|
||||
|
||||
await interaction.followup.send(
|
||||
file=discord.File(
|
||||
|
@ -1124,7 +1111,6 @@ class Aurora(commands.Cog):
|
|||
+ box(e, "py"),
|
||||
ephemeral=ephemeral,
|
||||
)
|
||||
cursor.close()
|
||||
database.close()
|
||||
return
|
||||
|
||||
|
|
Loading…
Reference in a new issue