rich presence sdk python discord code example
Example 1: discord rich presence python
import psutil
from pypresence import Presence
import time
client_id = '64567352374564'
RPC = Presence(client_id,pipe=0)
RPC.connect()
while True:
cpu_per = round(psutil.cpu_percent(),1)
mem = psutil.virtual_memory()
mem_per = round(psutil.virtual_memory().percent,1)
print(RPC.update(details="RAM: "+str(mem_per)+"%", state="CPU: "+str(cpu_per)+"%"))
time.sleep(15)
Example 2: how to make rich presence discord,py
await bot.change_presence(activity=discord.Game(name="Anything You Want"))