misc(moderation): removed checking channels' moderations history, will add back later on if I decide to add lockdown/slowmode/etc
All checks were successful
Pylint / Pylint (push) Successful in 1m13s

This commit is contained in:
Seaswimmer 2023-10-06 13:40:57 -04:00
parent 4a628cfc1d
commit 0925753404
No known key found for this signature in database
GPG key ID: 5019678FD9CF50D8

View file

@ -446,7 +446,7 @@ class Moderation(commands.Cog):
await self.mysql_log(interaction.guild.id, interaction.user.id, 'UNBAN', target.id, 'NULL', reason) await self.mysql_log(interaction.guild.id, interaction.user.id, 'UNBAN', target.id, 'NULL', reason)
@app_commands.command(name="history") @app_commands.command(name="history")
async def history(self, interaction: discord.Interaction, target: discord.Member = None, moderator: discord.Member = None, channel: discord.abc.GuildChannel = None, pagesize: app_commands.Range[int, 1, 25] = 5, page: int = 1): async def history(self, interaction: discord.Interaction, target: discord.Member = None, moderator: discord.Member = None, pagesize: app_commands.Range[int, 1, 25] = 5, page: int = 1):
"""List previous infractions.""" """List previous infractions."""
database = await self.connect() database = await self.connect()
cursor = database.cursor() cursor = database.cursor()
@ -462,13 +462,6 @@ class Moderation(commands.Cog):
WHERE moderator_id = %s WHERE moderator_id = %s
ORDER BY moderation_id DESC;""" ORDER BY moderation_id DESC;"""
cursor.execute(query, (interaction.guild.id, moderator.id)) cursor.execute(query, (interaction.guild.id, moderator.id))
elif channel:
query = """SELECT *
FROM moderation_%s
WHERE target_id = %s
ORDER BY moderation_id DESC;"""
cursor.execute(query, (interaction.guild.id, channel.id))
if target or moderator:
results = cursor.fetchall() results = cursor.fetchall()
result_dict_list = [] result_dict_list = []
for result in results: for result in results: