Revert "misc(aurora): some whitelabel changes"
All checks were successful
Pylint / Pylint (3.11) (push) Successful in 44s
All checks were successful
Pylint / Pylint (3.11) (push) Successful in 44s
This reverts commit b1edf79409
.
This commit is contained in:
parent
84fed6f17e
commit
910601a269
2 changed files with 27 additions and 27 deletions
|
@ -576,19 +576,19 @@ class Aurora(commands.Cog):
|
|||
cursor = database.cursor()
|
||||
|
||||
query = f"""SELECT *
|
||||
FROM {interaction.guild.id}
|
||||
FROM moderation_{interaction.guild.id}
|
||||
ORDER BY moderation_id DESC;"""
|
||||
cursor.execute(query)
|
||||
|
||||
results = cursor.fetchall()
|
||||
|
||||
try:
|
||||
filename = str(data_manager.cog_data_path(cog_instance=self)) + str(os.sep) + f"{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:
|
||||
json.dump(results, f, indent=2)
|
||||
|
||||
await interaction.followup.send(file=discord.File(filename, f"{interaction.guild.id}.json"), ephemeral=ephemeral)
|
||||
await interaction.followup.send(file=discord.File(filename, f"moderation_{interaction.guild.id}.json"), ephemeral=ephemeral)
|
||||
|
||||
os.remove(filename)
|
||||
except json.JSONDecodeError as e:
|
||||
|
@ -601,19 +601,19 @@ class Aurora(commands.Cog):
|
|||
|
||||
if target:
|
||||
query = f"""SELECT *
|
||||
FROM {interaction.guild.id}
|
||||
FROM moderation_{interaction.guild.id}
|
||||
WHERE target_id = ?
|
||||
ORDER BY moderation_id DESC;"""
|
||||
cursor.execute(query, (target.id,))
|
||||
elif moderator:
|
||||
query = f"""SELECT *
|
||||
FROM {interaction.guild.id}
|
||||
FROM moderation_{interaction.guild.id}
|
||||
WHERE moderator_id = ?
|
||||
ORDER BY moderation_id DESC;"""
|
||||
cursor.execute(query, (moderator.id,))
|
||||
else:
|
||||
query = f"""SELECT *
|
||||
FROM {interaction.guild.id}
|
||||
FROM moderation_{interaction.guild.id}
|
||||
ORDER BY moderation_id DESC;"""
|
||||
cursor.execute(query)
|
||||
|
||||
|
@ -695,14 +695,14 @@ class Aurora(commands.Cog):
|
|||
database = connect()
|
||||
cursor = database.cursor()
|
||||
|
||||
query_1 = f"SELECT * FROM {interaction.guild.id} WHERE moderation_id = ?;"
|
||||
query_1 = f"SELECT * FROM moderation_{interaction.guild.id} WHERE moderation_id = ?;"
|
||||
cursor.execute(query_1, (case,))
|
||||
result_1 = cursor.fetchone()
|
||||
if result_1 is None or case == 0:
|
||||
await interaction.response.send_message(content=f"There is no moderation with a case number of {case}.", ephemeral=True)
|
||||
return
|
||||
|
||||
query_2 = f"SELECT * FROM {interaction.guild.id} WHERE moderation_id = ? AND resolved = 0;"
|
||||
query_2 = f"SELECT * FROM moderation_{interaction.guild.id} WHERE moderation_id = ? AND resolved = 0;"
|
||||
cursor.execute(query_2, (case,))
|
||||
result_2 = cursor.fetchone()
|
||||
if result_2 is None:
|
||||
|
@ -755,9 +755,9 @@ class Aurora(commands.Cog):
|
|||
except discord.NotFound:
|
||||
pass
|
||||
|
||||
resolve_query = f"UPDATE `{interaction.guild.id}` SET resolved = 1, changes = ?, resolved_by = ?, resolve_reason = ? WHERE moderation_id = ?"
|
||||
resolve_query = f"UPDATE `moderation_{interaction.guild.id}` SET resolved = 1, changes = ?, resolved_by = ?, resolve_reason = ? WHERE moderation_id = ?"
|
||||
else:
|
||||
resolve_query = f"UPDATE `{interaction.guild.id}` SET resolved = 1, changes = ?, resolved_by = ?, resolve_reason = ? WHERE moderation_id = ?"
|
||||
resolve_query = f"UPDATE `moderation_{interaction.guild.id}` SET resolved = 1, changes = ?, resolved_by = ?, resolve_reason = ? WHERE moderation_id = ?"
|
||||
|
||||
cursor.execute(resolve_query, (json.dumps(changes), interaction.user.id, reason, case_dict['moderation_id']))
|
||||
database.commit()
|
||||
|
@ -802,7 +802,7 @@ class Aurora(commands.Cog):
|
|||
if case_dict:
|
||||
if export:
|
||||
if export.value == 'file' or len(str(case_dict)) > 1800:
|
||||
filename = str(data_manager.cog_data_path(cog_instance=self)) + str(os.sep) + f"{interaction.guild.id}_case_{case}.json"
|
||||
filename = str(data_manager.cog_data_path(cog_instance=self)) + str(os.sep) + f"moderation_{interaction.guild.id}_case_{case}.json"
|
||||
|
||||
with open(filename, "w", encoding="utf-8") as f:
|
||||
json.dump(case_dict, f, indent=2)
|
||||
|
@ -812,7 +812,7 @@ class Aurora(commands.Cog):
|
|||
else:
|
||||
content = f"Case #{case:,} exported."
|
||||
|
||||
await interaction.response.send_message(content=content, file=discord.File(filename, f"{interaction.guild.id}_case_{case}.json"), ephemeral=ephemeral)
|
||||
await interaction.response.send_message(content=content, file=discord.File(filename, f"moderation_{interaction.guild.id}_case_{case}.json"), ephemeral=ephemeral)
|
||||
|
||||
os.remove(filename)
|
||||
return
|
||||
|
@ -914,10 +914,10 @@ class Aurora(commands.Cog):
|
|||
cursor = database.cursor()
|
||||
|
||||
if parsed_time:
|
||||
update_query = f"UPDATE `{interaction.guild.id}` SET changes = %s, reason = %s, duration = %s, end_timestamp = %s WHERE moderation_id = %s"
|
||||
update_query = f"UPDATE `moderation_{interaction.guild.id}` SET changes = %s, reason = %s, duration = %s, end_timestamp = %s WHERE moderation_id = %s"
|
||||
cursor.execute(update_query, (json.dumps(changes), reason, parsed_time, end_timestamp, case))
|
||||
else:
|
||||
update_query = f"UPDATE `{interaction.guild.id}` SET changes = %s, reason = %s WHERE moderation_id = %s"
|
||||
update_query = f"UPDATE `moderation_{interaction.guild.id}` SET changes = %s, reason = %s WHERE moderation_id = %s"
|
||||
cursor.execute(update_query, (json.dumps(changes), reason, case))
|
||||
database.commit()
|
||||
|
||||
|
@ -941,7 +941,7 @@ class Aurora(commands.Cog):
|
|||
for guild in guilds:
|
||||
if not await self.bot.cog_disabled_in_guild(self, guild):
|
||||
|
||||
tempban_query = f"SELECT target_id, moderation_id FROM {guild.id} WHERE end_timestamp != 0 AND end_timestamp <= ? AND moderation_type = 'TEMPBAN' AND expired = 0"
|
||||
tempban_query = f"SELECT target_id, moderation_id FROM moderation_{guild.id} WHERE end_timestamp != 0 AND end_timestamp <= ? AND moderation_type = 'TEMPBAN' AND expired = 0"
|
||||
|
||||
try:
|
||||
cursor.execute(tempban_query, (time.time(),))
|
||||
|
@ -966,10 +966,10 @@ class Aurora(commands.Cog):
|
|||
except [discord.errors.NotFound, discord.errors.Forbidden, discord.errors.HTTPException] as e:
|
||||
print(f"Failed to unban {user.name}#{user.discriminator} ({user.id}) from {guild.name} ({guild.id})\n{e}")
|
||||
|
||||
expiry_query = f"UPDATE `{guild.id}` SET expired = 1 WHERE (end_timestamp != 0 AND end_timestamp <= ? AND expired = 0 AND moderation_type != 'BLACKLIST') OR (expired = 0 AND resolved = 1 AND moderation_type != 'BLACKLIST')"
|
||||
expiry_query = f"UPDATE `moderation_{guild.id}` SET expired = 1 WHERE (end_timestamp != 0 AND end_timestamp <= ? AND expired = 0 AND moderation_type != 'BLACKLIST') OR (expired = 0 AND resolved = 1 AND moderation_type != 'BLACKLIST')"
|
||||
cursor.execute(expiry_query, (time.time(),))
|
||||
|
||||
blacklist_query = f"SELECT target_id, moderation_id, role_id FROM {guild.id} WHERE end_timestamp != 0 AND end_timestamp <= ? AND moderation_type = 'BLACKLIST' AND expired = 0"
|
||||
blacklist_query = f"SELECT target_id, moderation_id, role_id FROM moderation_{guild.id} WHERE end_timestamp != 0 AND end_timestamp <= ? AND moderation_type = 'BLACKLIST' AND expired = 0"
|
||||
try:
|
||||
cursor.execute(blacklist_query, (time.time(),))
|
||||
result = cursor.fetchall()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue