1# Setting `Playing ` status
2await bot.change_presence(activity=discord.Game(name="a game"))
3
4# Setting `Streaming ` status
5await bot.change_presence(activity=discord.Streaming(name="My Stream", url=my_twitch_url))
6
7# Setting `Listening ` status
8await bot.change_presence(activity=discord.Activity(type=discord.ActivityType.listening, name="a song"))
9
10# Setting `Watching ` status
11await bot.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name="a movie"))
12
1import psutil
2from pypresence import Presence
3import time
4
5client_id = '64567352374564' # Fake ID, put your real one here
6RPC = Presence(client_id,pipe=0) # Initialize the client class
7RPC.connect() # Start the handshake loop
8
9
10while True: # The presence will stay on as long as the program is running
11 cpu_per = round(psutil.cpu_percent(),1) # Get CPU Usage
12 mem = psutil.virtual_memory()
13 mem_per = round(psutil.virtual_memory().percent,1)
14 print(RPC.update(details="RAM: "+str(mem_per)+"%", state="CPU: "+str(cpu_per)+"%")) # Set the presence
15 time.sleep(15) # Can only update rich presence every 15 seconds
16