From 56d316b6fabc78e4b88ba2dbedda9e0e549b40c7 Mon Sep 17 00:00:00 2001 From: SeaswimmerTheFsh Date: Mon, 18 Dec 2023 16:33:09 -0500 Subject: [PATCH] fix(moderation): fixed trying to import the 0th case --- moderation/importers/moderation.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/moderation/importers/moderation.py b/moderation/importers/moderation.py index 7c02126..5292130 100644 --- a/moderation/importers/moderation.py +++ b/moderation/importers/moderation.py @@ -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'