Answers for "discord custom rich presence python"

1

discord rich presence python

import psutil
from pypresence import Presence
import time

client_id = '64567352374564'  # Fake ID, put your real one here
RPC = Presence(client_id,pipe=0)  # Initialize the client class
RPC.connect() # Start the handshake loop


while True:  # The presence will stay on as long as the program is running
    cpu_per = round(psutil.cpu_percent(),1) # Get CPU Usage
    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)+"%"))  # Set the presence
    time.sleep(15) # Can only update rich presence every 15 seconds
Posted by: Guest on October-09-2020
2

how to make rich presence discord,py

await bot.change_presence(activity=discord.Game(name="Anything You Want"))
Posted by: Guest on June-04-2020

Code answers related to "discord custom rich presence python"

Python Answers by Framework

Browse Popular Code Answers by Language