fix(moderation): fixed trying to import the 0th case
Some checks failed
Pylint / Pylint (3.10) (push) Failing after 45s
Some checks failed
Pylint / Pylint (3.10) (push) Failing after 45s
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...")
|
await interaction.edit_original_response(content="Importing moderations...")
|
||||||
|
|
||||||
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['moderation_id'])
|
data: [dict] = sorted(json.loads(file), key=lambda x: x['moderation_id'])
|
||||||
|
|
||||||
user_mod_types = [
|
user_mod_types = [
|
||||||
'NOTE',
|
'NOTE',
|
||||||
|
@ -51,6 +51,9 @@ class ImportModerationView(ui.View):
|
||||||
failed_cases = []
|
failed_cases = []
|
||||||
|
|
||||||
for case in data:
|
for case in data:
|
||||||
|
if case['moderation_id'] == 0:
|
||||||
|
continue
|
||||||
|
|
||||||
if 'target_type' not in case or not case['target_type']:
|
if 'target_type' not in case or not case['target_type']:
|
||||||
if case['moderation_type'] in user_mod_types:
|
if case['moderation_type'] in user_mod_types:
|
||||||
case['target_type'] = 'USER'
|
case['target_type'] = 'USER'
|
||||||
|
|
Loading…
Reference in a new issue