From 095528232532b123bc0e9ba06d59f44f384957aa Mon Sep 17 00:00:00 2001 From: SeaswimmerTheFsh Date: Mon, 8 Apr 2024 06:24:34 -0400 Subject: [PATCH] fix(aurora): do not run handle_expiry before Red is ready --- aurora/aurora.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/aurora/aurora.py b/aurora/aurora.py index 8a437cb..8a602eb 100644 --- a/aurora/aurora.py +++ b/aurora/aurora.py @@ -18,7 +18,8 @@ from redbot.core import app_commands, commands, data_manager from redbot.core.app_commands import Choice from redbot.core.bot import Red from redbot.core.commands.converter import parse_relativedelta, parse_timedelta -from redbot.core.utils.chat_formatting import box, error, humanize_list, humanize_timedelta, warning +from redbot.core.utils.chat_formatting import (box, error, humanize_list, + humanize_timedelta, warning) from aurora.importers.aurora import ImportAuroraView from aurora.importers.galacticbot import ImportGalacticBotView @@ -27,10 +28,18 @@ from aurora.menus.guild import Guild from aurora.menus.immune import Immune from aurora.menus.overrides import Overrides from aurora.utilities.config import config, register_config -from aurora.utilities.database import connect, create_guild_table, fetch_case, 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.database import (connect, create_guild_table, fetch_case, + 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.logger import logger -from aurora.utilities.utils import check_moddable, check_permissions, convert_timedelta_to_str, fetch_channel_dict, fetch_user_dict, generate_dict, log, send_evidenceformat, timedelta_from_relativedelta +from aurora.utilities.utils import (check_moddable, check_permissions, + convert_timedelta_to_str, + fetch_channel_dict, fetch_user_dict, + generate_dict, log, send_evidenceformat, + timedelta_from_relativedelta) class Aurora(commands.Cog): @@ -1486,6 +1495,7 @@ class Aurora(commands.Cog): @tasks.loop(minutes=1) async def handle_expiry(self): + await self.bot.wait_until_red_ready() current_time = time.time() database = connect() cursor = database.cursor()