A lightweight and safe module for creating custom rich presences on Discord.
Project description
discord-rich-presence
A lightweight and safe module for creating custom rich presences on Discord.
Example
How to Use
Making a Discord App
- Create an app by clicking "New Application" in the Discord Developers Portal.
- Give your app a name and an icon (this can be changed later). Make sure to save your changes.
- Optional: Go to "Rich Presence", and add a few images under the "Rich Presence Assets" section.
- Under "Application Id" in the "General Information" tab, copy your app's id.
Installation
- Install the latest version of Python if you haven't already.
- Run the following in your terminal:
$ pip install discord-rich-presence
If all goes well, it should say something like "Successfully installed discord-rich-presence".
Writing the Code
- Create a file ending in
.py
, and paste in the following example from examples/simple.py:
from discordrp import Presence
import time
client_id = '000000000000000000' # Replace this with your own client id
with Presence(client_id) as presence:
presence.set({
'state': 'In Game',
'details': "Summoner's Rift",
'timestamps': {
'start': int(time.time())
},
})
while True:
time.sleep(15)
Make sure you replace the client_id
variable with your app's id that you copied earlier.
- Run the program! You should now see that you have a rich presence on your profile that will be on until you stop the program! Feel free to change the code however you want by adding images, buttons, and more. Check out examples/complex.py for another example.
Troubleshooting
If you're having trouble using this module, it might be because of the following:
- your Discord app is not open
- you passed in an incorrect dictionary, which the Discord API rejected
- something unexpected occurred while writing data, in which you should try running the program again
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file discord-rich-presence-1.0.1.tar.gz
.
File metadata
- Download URL: discord-rich-presence-1.0.1.tar.gz
- Upload date:
- Size: 4.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2298453dc7fe98c742c9c8c0bd27edf763cd81c9ce65af7a325d723df2264493 |
|
MD5 | ab157bf71ecfa7a0d5cf8e3cadfdb16e |
|
BLAKE2b-256 | 07a07a2a0429aa6a32c65f0f8c6874c93140788cb6cc90cc31980c9074a6e531 |
File details
Details for the file discord_rich_presence-1.0.1-py3-none-any.whl
.
File metadata
- Download URL: discord_rich_presence-1.0.1-py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c88279c3d0719d713274e0106e4f8fc8109d1d67aa63516b560fc7c3a8e1d462 |
|
MD5 | 180c3098a1c6598251f26ad69851b7de |
|
BLAKE2b-256 | 2bcdaed492c3def73a05f0770c6b953c476aba0c664343882c6b856d06e50606 |