fix(aurora): minor changes to the aurora importer and also fixed a bug in the Moderation.get_latest method
This commit is contained in:
parent
8822d1714e
commit
cbd82f8572
3 changed files with 10 additions and 8 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue