forked from cswimr/SeaCogs
fix(moderation): fixed trying to import the 0th case
This commit is contained in:
parent
f8b1e03d0e
commit
56d316b6fa
1 changed files with 4 additions and 1 deletions
|
@ -31,7 +31,7 @@ class ImportModerationView(ui.View):
|
|||
await interaction.edit_original_response(content="Importing moderations...")
|
||||
|
||||
file = await self.ctx.message.attachments[0].read()
|
||||
data = sorted(json.loads(file), key=lambda x: x['moderation_id'])
|
||||
data: [dict] = sorted(json.loads(file), key=lambda x: x['moderation_id'])
|
||||
|
||||
user_mod_types = [
|
||||
'NOTE',
|
||||
|
@ -51,6 +51,9 @@ class ImportModerationView(ui.View):
|
|||
failed_cases = []
|
||||
|
||||
for case in data:
|
||||
if case['moderation_id'] == 0:
|
||||
continue
|
||||
|
||||
if 'target_type' not in case or not case['target_type']:
|
||||
if case['moderation_type'] in user_mod_types:
|
||||
case['target_type'] = 'USER'
|
||||
|
|
Loading…
Reference in a new issue