11 lines
439 B
Python
11 lines
439 B
Python
import asyncio,random,time
|
|
async def presence(bot,interval=45):
|
|
await bot.wait_until_ready()
|
|
since=int(time.time()*1000)
|
|
while True:
|
|
payload={"op":3,"d":{"status":"idle","since":since,"afk":True,"activities":[]}}
|
|
try:
|
|
if bot.ws:await bot.ws.send_as_json(payload)
|
|
except Exception as e:bot.hook.put(f"presence update failed: {e!r}")
|
|
await asyncio.sleep(interval+random.uniform(-5,5))
|