forked from cswimr/SeaCogs
fix(moderation): infinite loop
This commit is contained in:
parent
c700782e17
commit
d300ba60da
1 changed files with 5 additions and 2 deletions
|
@ -1739,7 +1739,7 @@ class Moderation(commands.Cog):
|
||||||
file = await self.ctx.message.attachments[0].read()
|
file = await self.ctx.message.attachments[0].read()
|
||||||
data = sorted(json.loads(file), key=lambda x: x['case'])
|
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:
|
for case in data:
|
||||||
if case['type'] not in accepted_types:
|
if case['type'] not in accepted_types:
|
||||||
continue
|
continue
|
||||||
|
@ -1794,7 +1794,10 @@ class Moderation(commands.Cog):
|
||||||
|
|
||||||
await interaction.edit_original_response(content="Import complete.")
|
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)
|
@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
|
async def import_button_n(self, interaction: discord.Interaction, button: discord.ui.Button): # pylint: disable=unused-argument
|
||||||
|
|
Loading…
Reference in a new issue