feat: set status to idle appropriately

This commit is contained in:
2025-01-05 19:23:50 -05:00
parent d7ab46a20e
commit 3848deb887
5 changed files with 41 additions and 1 deletions

28
tasks.py Normal file
View File

@@ -0,0 +1,28 @@
import asyncio
import time
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)
targets = []
for id, player in players:
if len(player.queue) == 0:
targets.append(id)
for target in targets:
del players[target]