fix: runs threads for background tasks
This commit is contained in:
20
tasks.py
20
tasks.py
@@ -6,16 +6,6 @@ import disnake
|
||||
from state import client, last_used, players
|
||||
|
||||
|
||||
async def check_idle():
|
||||
while True:
|
||||
await asyncio.sleep(3600)
|
||||
|
||||
if time.time() - last_used >= 3600:
|
||||
await client.change_presence(status=disnake.Status.idle)
|
||||
else:
|
||||
await client.change_presence(status=disnake.Status.online)
|
||||
|
||||
|
||||
async def cleanup():
|
||||
while True:
|
||||
await asyncio.sleep(3600)
|
||||
@@ -26,3 +16,13 @@ async def cleanup():
|
||||
targets.append(id)
|
||||
for target in targets:
|
||||
del players[target]
|
||||
|
||||
|
||||
async def check_idle():
|
||||
while True:
|
||||
await asyncio.sleep(3600)
|
||||
|
||||
if time.time() - last_used >= 3600:
|
||||
await client.change_presence(status=disnake.Status.idle)
|
||||
else:
|
||||
await client.change_presence(status=disnake.Status.online)
|
||||
|
||||
Reference in New Issue
Block a user