To communicate with Discord's Rich Presence API (discord-rpc) in Python, you'll need to install the pypresence
library using pip
.
main.py23 chars2 lines
Once you have pypresence
installed, you can import it and create a Client
object. Then, you can use various methods to communicate with the API and update your Discord presence.
main.py329 chars15 lines
The update()
method takes various parameters such as state
, details
, start
, end
, large_image
, and small_image
. These parameters define your presence details such as the game you are playing, your current status, and even the images you want to display.
Don't forget to close the connection with the API when you are done using the close()
method.
main.py12 chars2 lines
With these basic steps, you can use discord-rpc to enable your users to show off their current activities on Discord.
gistlibby LogSnag