Skip to main content

A lightweight and safe module for creating custom rich presences on Discord.

Project description

discord-rich-presence

A lightweight and safe package for creating custom rich presences on Discord.

Example

Discord Rich Presence Example

How to Use

Making a Discord App

  1. Create an app by clicking "New Application" in the Discord Developers Portal.
  2. 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.
  3. Under "Application Id" in the "General Information" tab, copy your app's id.

Installation

  1. Install the latest version of Python if you haven't already.
  2. 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

  1. 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.

  1. 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 to Presence.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.
  • ConnectionRefusedError or FileNotFoundError: 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

discord-rich-presence-1.1.0.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

discord_rich_presence-1.1.0-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file discord-rich-presence-1.1.0.tar.gz.

File metadata

  • Download URL: discord-rich-presence-1.1.0.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.2

File hashes

Hashes for discord-rich-presence-1.1.0.tar.gz
Algorithm Hash digest
SHA256 58fb1601cc65cf4f7bf6e1225b924df716fca7f0755afe2eb66d25c2cb3cf480
MD5 63e5aa050f8ad1bb1e75dc910cddf650
BLAKE2b-256 995c476e00d8fa145c29db353c3d6c9d936c146b4461c12310154420d3ca4211

See more details on using hashes here.

File details

Details for the file discord_rich_presence-1.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for discord_rich_presence-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4b8d2e6e68e8f70df2547847f5dbf5a2cb1e6a7ab394e277c6fabee5c705c19a
MD5 010da6c041f0d5fe905e42138b4cbdf4
BLAKE2b-256 b373cd32e23cb17fb328097b7bc916c535e38e2c8f7b79844fc6d67c0e6d5de7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page