fix(aurora): convert results into a dictionary before making a Moderation instance out of them

This commit is contained in:
Seaswimmer 2024-05-06 16:07:35 -04:00
parent d7a8fbe367
commit 53b67e1c95
Signed by untrusted user: cswimr
GPG key ID: 5D671B5D03D65A7F

View file

@ -20,8 +20,7 @@ from redbot.core import app_commands, commands, data_manager
from redbot.core.app_commands import Choice from redbot.core.app_commands import Choice
from redbot.core.bot import Red from redbot.core.bot import Red
from redbot.core.commands.converter import parse_relativedelta, parse_timedelta from redbot.core.commands.converter import parse_relativedelta, parse_timedelta
from redbot.core.utils.chat_formatting import (box, error, humanize_list, from redbot.core.utils.chat_formatting import box, error, humanize_list, humanize_timedelta, warning
humanize_timedelta, warning)
from aurora.importers.aurora import ImportAuroraView from aurora.importers.aurora import ImportAuroraView
from aurora.importers.galacticbot import ImportGalacticBotView from aurora.importers.galacticbot import ImportGalacticBotView
@ -31,17 +30,11 @@ from aurora.menus.immune import Immune
from aurora.menus.overrides import Overrides from aurora.menus.overrides import Overrides
from aurora.models import Change, Moderation from aurora.models import Change, Moderation
from aurora.utilities.config import config, register_config from aurora.utilities.config import config, register_config
from aurora.utilities.database import (connect, create_guild_table, fetch_case, from aurora.utilities.database import connect, create_guild_table, fetch_case, mysql_log
mysql_log) from aurora.utilities.factory import addrole_embed, case_factory, changes_factory, evidenceformat_factory, guild_embed, immune_embed, message_factory, overrides_embed
from aurora.utilities.factory import (addrole_embed, case_factory,
changes_factory, evidenceformat_factory,
guild_embed, immune_embed,
message_factory, overrides_embed)
from aurora.utilities.json import dump from aurora.utilities.json import dump
from aurora.utilities.logger import logger from aurora.utilities.logger import logger
from aurora.utilities.utils import (check_moddable, check_permissions, from aurora.utilities.utils import check_moddable, check_permissions, generate_dict, get_footer_image, log, send_evidenceformat, timedelta_from_relativedelta
get_footer_image, log, send_evidenceformat,
timedelta_from_relativedelta)
class Aurora(commands.Cog): class Aurora(commands.Cog):
@ -1125,8 +1118,8 @@ class Aurora(commands.Cog):
moderation_list: List[Moderation] = [] moderation_list: List[Moderation] = []
for result in results: for result in results:
result.update({"guild_id": interaction.guild.id}) result_dictionary = generate_dict(result)
moderation = Moderation.from_dict(interaction.client, dict(result)) moderation = Moderation.from_dict(interaction.client, result_dictionary)
moderation_list.append(moderation) moderation_list.append(moderation)
case_quantity = len(moderation_list) case_quantity = len(moderation_list)