Answers for "discord.py presence"

4

discord.py presence

# Setting `Playing ` status
await bot.change_presence(activity=discord.Game(name="a game"))

# Setting `Streaming ` status
await bot.change_presence(activity=discord.Streaming(name="My Stream", url=my_twitch_url))

# Setting `Listening ` status
await bot.change_presence(activity=discord.Activity(type=discord.ActivityType.listening, name="a song"))

# Setting `Watching ` status
await bot.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name="a movie"))
Posted by: Guest on April-05-2021
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.py presence"

Python Answers by Framework

Browse Popular Code Answers by Language