forked from cswimr/SeaCogs
fix(moderation): reverted previous changes (they dont work lmao)
This commit is contained in:
parent
d300ba60da
commit
30ea17cfb6
1 changed files with 49 additions and 56 deletions
|
@ -5,7 +5,6 @@
|
||||||
# ____) | __/ (_| \__ \\ V V /| | | | | | | | | | | | __/ |
|
# ____) | __/ (_| \__ \\ V V /| | | | | | | | | | | | __/ |
|
||||||
# |_____/ \___|\__,_|___/ \_/\_/ |_|_| |_| |_|_| |_| |_|\___|_|
|
# |_____/ \___|\__,_|___/ \_/\_/ |_|_| |_| |_|_| |_| |_|\___|_|
|
||||||
|
|
||||||
import asyncio
|
|
||||||
import logging
|
import logging
|
||||||
import json
|
import json
|
||||||
import time
|
import time
|
||||||
|
@ -1739,7 +1738,6 @@ 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, 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
|
||||||
|
@ -1748,7 +1746,7 @@ class Moderation(commands.Cog):
|
||||||
|
|
||||||
if case['duration']:
|
if case['duration']:
|
||||||
try:
|
try:
|
||||||
duration = timedelta(seconds=round(case['duration']) / 1000)
|
duration = timedelta(seconds=round(float(case['duration']) / 1000))
|
||||||
except OverflowError:
|
except OverflowError:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
@ -1794,11 +1792,6 @@ class Moderation(commands.Cog):
|
||||||
|
|
||||||
await interaction.edit_original_response(content="Import complete.")
|
await interaction.edit_original_response(content="Import complete.")
|
||||||
|
|
||||||
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
|
||||||
await self.message.edit("Import cancelled.", view=None)
|
await self.message.edit("Import cancelled.", view=None)
|
||||||
|
|
Loading…
Reference in a new issue