[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
This commit is contained in:
parent
4629270695
commit
7b76bc10e0
@ -21,6 +21,10 @@ class Timerole(Cog):
|
|||||||
|
|
||||||
self.config.register_global(**default_global)
|
self.config.register_global(**default_global)
|
||||||
self.config.register_guild(**default_guild)
|
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()
|
@commands.command()
|
||||||
@checks.guildowner()
|
@checks.guildowner()
|
||||||
@ -193,19 +197,5 @@ class Timerole(Cog):
|
|||||||
|
|
||||||
async def check_day(self):
|
async def check_day(self):
|
||||||
while self is self.bot.get_cog("Timerole"):
|
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 self.timerole_update()
|
||||||
|
await asyncio.sleep(86400)
|
||||||
await asyncio.sleep(3)
|
|
||||||
# then start loop over again
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user