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()
|
database = connect()
|
||||||
|
|
||||||
if export:
|
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:
|
try:
|
||||||
filename = (
|
filename = (
|
||||||
str(data_manager.cog_data_path(cog_instance=self))
|
str(data_manager.cog_data_path(cog_instance=self))
|
||||||
|
@ -1105,8 +1090,10 @@ class Aurora(commands.Cog):
|
||||||
+ f"moderation_{interaction.guild.id}.json"
|
+ 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:
|
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(
|
await interaction.followup.send(
|
||||||
file=discord.File(
|
file=discord.File(
|
||||||
|
@ -1124,7 +1111,6 @@ class Aurora(commands.Cog):
|
||||||
+ box(e, "py"),
|
+ box(e, "py"),
|
||||||
ephemeral=ephemeral,
|
ephemeral=ephemeral,
|
||||||
)
|
)
|
||||||
cursor.close()
|
|
||||||
database.close()
|
database.close()
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue