From d300ba60da4348e73f3fb89e74b1ea986ac5fe9f Mon Sep 17 00:00:00 2001 From: SeaswimmerTheFsh Date: Sat, 16 Dec 2023 13:53:38 -0500 Subject: [PATCH] fix(moderation): infinite loop --- moderation/moderation.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/moderation/moderation.py b/moderation/moderation.py index c9ef28b..47cc7b2 100644 --- a/moderation/moderation.py +++ b/moderation/moderation.py @@ -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