fix(aurora): minor changes to the aurora importer and also fixed a bug in the Moderation.get_latest method
All checks were successful
Actions / Build Documentation (MkDocs) (pull_request) Successful in 29s
Actions / Lint Code (Ruff & Pylint) (pull_request) Successful in 42s

This commit is contained in:
Seaswimmer 2024-08-12 18:50:07 -04:00
parent 8822d1714e
commit cbd82f8572
Signed by: cswimr
GPG key ID: 3813315477F26F82
3 changed files with 10 additions and 8 deletions

View file

@ -2,7 +2,7 @@
import json
import os
from time import time
from typing import Dict
from typing import Dict, List
from discord import ButtonStyle, File, Interaction, Message, ui
from redbot.core import commands, data_manager
@ -15,10 +15,11 @@ from ..utilities.utils import create_guild_table, timedelta_from_string
class ImportAuroraView(ui.View):
def __init__(self, timeout, ctx, message):
def __init__(self, timeout, ctx, message, data: List[Dict[str, any]]):
super().__init__()
self.ctx: commands.Context = ctx
self.message: Message = message
self.data: List[Dict[str, any]] = data
@ui.button(label="Yes", style=ButtonStyle.success)
async def import_button_y(
@ -38,12 +39,9 @@ class ImportAuroraView(ui.View):
await interaction.edit_original_response(content="Importing moderations...")
file = await self.ctx.message.attachments[0].read()
data: list[dict] = sorted(json.loads(file), key=lambda x: x["moderation_id"])
failed_cases = []
for case in data:
for case in self.data:
if case["moderation_id"] == 0:
continue