Move current_election setting. The bot needs to be ready first.
build_develop / build (push) Successful in 1m22s

This commit is contained in:
2023-09-08 11:42:34 -04:00
parent c5c242de21
commit 2640ebdad1
+5 -1
View File
@@ -19,7 +19,7 @@ class DailyLoop(commands.Cog, name="Daily Loop"):
def __init__(self, bot: commands.Bot) -> None:
self.bot = bot
self.current_election = self.get_current_cycle()
self.current_election = None
@commands.Cog.listener()
async def on_ready(self):
@@ -27,6 +27,10 @@ class DailyLoop(commands.Cog, name="Daily Loop"):
Starts the loop when bot is ready.
"""
await self.bot.wait_until_ready()
# wait until the discord bot is all ready. Bot needs to know guilds.
self.current_election = self.get_current_cycle()
# pylint doesn't recognize that periodic_update_guild_data is subclassed from tasks.loop.
await self.daily_loop.start() # pylint: disable=no-member