[Timerole] There was 2 issues with the check_day def (#67)

* Update ccrole.py

* listener

* Update qrinvite.py

* Update qrinvite.py

* Make default enabled False

Made default enabled False, this is because with a decent amount of users this skyrockets your CPU, so making this default off, only servers that actually want it will be enabled, thus reducing CPU usage.

* Update dad.py

* Add optional bot count and online count

* Update timerole.py

* Update timerole.py

* Update timerole.py

* Update timerole.py

* Update timerole.py
pull/69/head
Ianardo DiCaprio 6 years ago committed by bobloy
parent 4629270695
commit 7b76bc10e0

@ -21,6 +21,10 @@ class Timerole(Cog):
self.config.register_global(**default_global)
self.config.register_guild(**default_guild)
self.updating = self.bot.loop.create_task(self.check_day())
def cog_unload(self):
self.updating.cancel()
@commands.command()
@checks.guildowner()
@ -193,19 +197,5 @@ class Timerole(Cog):
async def check_day(self):
while self is self.bot.get_cog("Timerole"):
tomorrow = datetime.now() + timedelta(days=1)
midnight = datetime(
year=tomorrow.year,
month=tomorrow.month,
day=tomorrow.day,
hour=0,
minute=0,
second=0,
)
await asyncio.sleep((midnight - datetime.now()).seconds)
await self.timerole_update()
await asyncio.sleep(3)
# then start loop over again
await asyncio.sleep(86400)

Loading…
Cancel
Save