fix(moderation): removed case 0 from the export
Some checks failed
Pylint / Pylint (3.10) (push) Failing after 53s
Some checks failed
Pylint / Pylint (3.10) (push) Failing after 53s
This commit is contained in:
parent
dd778587bb
commit
33ac32c086
1 changed files with 3 additions and 6 deletions
|
@ -744,6 +744,8 @@ class Moderation(commands.Cog):
|
||||||
result_dict_list = []
|
result_dict_list = []
|
||||||
for result in results:
|
for result in results:
|
||||||
case_dict = self.generate_dict(result)
|
case_dict = self.generate_dict(result)
|
||||||
|
if case_dict['moderation_id'] == 0:
|
||||||
|
continue
|
||||||
result_dict_list.append(case_dict)
|
result_dict_list.append(case_dict)
|
||||||
if export:
|
if export:
|
||||||
try:
|
try:
|
||||||
|
@ -756,10 +758,7 @@ class Moderation(commands.Cog):
|
||||||
except json.JSONDecodeError as e:
|
except json.JSONDecodeError as e:
|
||||||
await interaction.followup.send(content=f"An error occured while exporting the moderation history.\nError:\n```{e}```", ephemeral=ephemeral)
|
await interaction.followup.send(content=f"An error occured while exporting the moderation history.\nError:\n```{e}```", ephemeral=ephemeral)
|
||||||
return
|
return
|
||||||
if target or moderator:
|
case_quantity = len(result_dict_list)
|
||||||
case_quantity = len(result_dict_list)
|
|
||||||
else:
|
|
||||||
case_quantity = len(result_dict_list) - 1 # account for case 0 technically existing
|
|
||||||
page_quantity = round(case_quantity / pagesize)
|
page_quantity = round(case_quantity / pagesize)
|
||||||
start_index = (page - 1) * pagesize
|
start_index = (page - 1) * pagesize
|
||||||
end_index = page * pagesize
|
end_index = page * pagesize
|
||||||
|
@ -767,8 +766,6 @@ class Moderation(commands.Cog):
|
||||||
embed.set_author(icon_url=interaction.guild.icon.url, name='Infraction History')
|
embed.set_author(icon_url=interaction.guild.icon.url, name='Infraction History')
|
||||||
embed.set_footer(text=f"Page {page}/{page_quantity} | {case_quantity} Results")
|
embed.set_footer(text=f"Page {page}/{page_quantity} | {case_quantity} Results")
|
||||||
for case in result_dict_list[start_index:end_index]:
|
for case in result_dict_list[start_index:end_index]:
|
||||||
if str(case['moderation_id']) == '0':
|
|
||||||
continue
|
|
||||||
target_user = await self.fetch_user_dict(interaction, case['target_id'])
|
target_user = await self.fetch_user_dict(interaction, case['target_id'])
|
||||||
moderator_user = await self.fetch_user_dict(interaction, case['moderator_id'])
|
moderator_user = await self.fetch_user_dict(interaction, case['moderator_id'])
|
||||||
target_name = f"`{target_user['name']}`" if target_user['discriminator'] == "0" else f"`{target_user['name']}#{target_user['discriminator']}`"
|
target_name = f"`{target_user['name']}`" if target_user['discriminator'] == "0" else f"`{target_user['name']}#{target_user['discriminator']}`"
|
||||||
|
|
Loading…
Reference in a new issue