diff --git a/announcedaily/__init__.py b/announcedaily/__init__.py index 07e6740..8cc69d5 100644 --- a/announcedaily/__init__.py +++ b/announcedaily/__init__.py @@ -5,5 +5,5 @@ from .announcedaily import AnnounceDaily def setup(bot: Red): daily = AnnounceDaily(bot) - bot.loop.create_task(daily.check_day()) bot.add_cog(daily) + bot.loop.create_task(daily.check_day()) diff --git a/announcedaily/announcedaily.py b/announcedaily/announcedaily.py index 83b7d1d..67a0cf0 100644 --- a/announcedaily/announcedaily.py +++ b/announcedaily/announcedaily.py @@ -223,18 +223,21 @@ class AnnounceDaily: await channel.send(choice) async def check_day(self): - while self is self.bot.get_cog("Timerole"): + print("Out of start") + while self is self.bot.get_cog("AnnounceDaily"): + print("Start") tomorrow = datetime.now() + timedelta(days=1) time = await self.config.time() h, m, s = time['hour'], time['minute'], time['second'] midnight = datetime(year=tomorrow.year, month=tomorrow.month, day=tomorrow.day, hour=h, minute=m, second=s) + print("Sleeping for {} seconds".format((midnight - datetime.now()).seconds)) await asyncio.sleep((midnight - datetime.now()).seconds) if self is not self.bot.get_cog("Timerole"): return - + print("Pre-announce") await self.send_announcements() await asyncio.sleep(3)