fix(moderation): infinite loop

This commit is contained in:
Seaswimmer 2023-12-16 13:53:38 -05:00
parent c700782e17
commit d300ba60da
Signed by untrusted user: cswimr
GPG key ID: 1EBC234EEDA901AE

View file

@ -1739,7 +1739,7 @@ class Moderation(commands.Cog):
file = await self.ctx.message.attachments[0].read()
data = sorted(json.loads(file), key=lambda x: x['case'])
async def process_case(case, accepted_types):
async def process_case(case, accepted_types, interaction: discord.Interaction):
for case in data:
if case['type'] not in accepted_types:
continue
@ -1794,7 +1794,10 @@ class Moderation(commands.Cog):
await interaction.edit_original_response(content="Import complete.")
await asyncio.gather(*[process_case(case, accepted_types) for case in data])
async def process_cases(data, accepted_types, interaction):
await asyncio.gather(*[process_case(case, accepted_types, interaction) for case in data])
await process_cases(data, accepted_types, interaction)
@discord.ui.button(label="No", style=discord.ButtonStyle.danger)
async def import_button_n(self, interaction: discord.Interaction, button: discord.ui.Button): # pylint: disable=unused-argument