Not timerole you fool
This commit is contained in:
parent
d585e89fcd
commit
e09d43d1af
@ -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())
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user