discord-rich-presence
A lightweight and safe package 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:
print("Connected")
presence.set(
{
"state": "In Game",
"details": "Summoner's Rift",
"timestamps": {"start": int(time.time())},
}
)
print("Presence updated")
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
Here are the most common errors:
ActivityError: An incorrect dictionary was passed toPresence.set. Make sure that it matches the format expected by Discord.ClientIDError: Verify that your client ID is valid.PresenceError: Read the Discord docs for more information.ConnectionRefusedErrororFileNotFoundError: Make sure that your Discord application is open and logged in.- Program hangs for a long time and does not set the presence: Wait for at least 10 seconds before closing and trying again.
Release files for discord-rich-presence 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| discord-rich-presence-1.1.0.tar.gz | 5.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| discord_rich_presence-1.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.8 kB
Release files / discord-rich-presence-1.1.0.tar.gz
| Download URL | discord-rich-presence-1.1.0.tar.gz |
|---|---|
| Size | 5.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
58fb1601cc65cf4f7bf6e1225b924df716fca7f0755afe2eb66d25c2cb3cf480
|
|
BLAKE2b-256 checksum How to use checksums |
995c476e00d8fa145c29db353c3d6c9d936c146b4461c12310154420d3ca4211
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.2
|
Release files / discord_rich_presence-1.1.0-py3-none-any.whl
| Download URL | discord_rich_presence-1.1.0-py3-none-any.whl |
|---|---|
| Size | 6.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4b8d2e6e68e8f70df2547847f5dbf5a2cb1e6a7ab394e277c6fabee5c705c19a
|
|
BLAKE2b-256 checksum How to use checksums |
b373cd32e23cb17fb328097b7bc916c535e38e2c8f7b79844fc6d67c0e6d5de7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.2
|