aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bot/seasons/easter/egg_facts.py4
-rw-r--r--bot/seasons/pride/pride_facts.py4
2 files changed, 6 insertions, 2 deletions
diff --git a/bot/seasons/easter/egg_facts.py b/bot/seasons/easter/egg_facts.py
index e66e25a3..260a505a 100644
--- a/bot/seasons/easter/egg_facts.py
+++ b/bot/seasons/easter/egg_facts.py
@@ -24,6 +24,7 @@ class EasterFacts(commands.Cog):
def __init__(self, bot: commands.Bot):
self.bot = bot
self.facts = self.load_json()
+ self.daily_fact_task = self.bot.loop.create_task(self.send_egg_fact_daily())
@staticmethod
def load_json() -> dict:
@@ -34,7 +35,9 @@ class EasterFacts(commands.Cog):
async def send_egg_fact_daily(self) -> None:
"""A background task that sends an easter egg fact in the event channel everyday."""
+ await self.bot.wait_until_ready()
channel = self.bot.get_channel(Channels.seasonalbot_commands)
+
while True:
embed = self.make_embed()
await channel.send(embed=embed)
@@ -57,6 +60,5 @@ class EasterFacts(commands.Cog):
def setup(bot: commands.Bot) -> None:
"""Easter Egg facts cog load."""
- bot.loop.create_task(EasterFacts(bot).send_egg_fact_daily())
bot.add_cog(EasterFacts(bot))
log.info("EasterFacts cog loaded")
diff --git a/bot/seasons/pride/pride_facts.py b/bot/seasons/pride/pride_facts.py
index 5c19dfd0..fe5e3cf9 100644
--- a/bot/seasons/pride/pride_facts.py
+++ b/bot/seasons/pride/pride_facts.py
@@ -24,6 +24,7 @@ class PrideFacts(commands.Cog):
def __init__(self, bot: commands.Bot):
self.bot = bot
self.facts = self.load_facts()
+ self.daily_fact_task = self.bot.loop.create_task(self.send_pride_fact_daily())
@staticmethod
def load_facts() -> dict:
@@ -33,7 +34,9 @@ class PrideFacts(commands.Cog):
async def send_pride_fact_daily(self) -> None:
"""Background task to post the daily pride fact every day."""
+ await self.bot.wait_until_ready()
channel = self.bot.get_channel(Channels.seasonalbot_commands)
+
while True:
await self.send_select_fact(channel, datetime.utcnow())
await asyncio.sleep(24 * 60 * 60)
@@ -101,6 +104,5 @@ class PrideFacts(commands.Cog):
def setup(bot: commands.Bot) -> None:
"""Cog loader for pride facts."""
- bot.loop.create_task(PrideFacts(bot).send_pride_fact_daily())
bot.add_cog(PrideFacts(bot))
log.info("Pride facts cog loaded!")