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 module 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:
    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.

  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

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


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.0.3.tar.gz (5.0 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.0.3-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: discord-rich-presence-1.0.3.tar.gz
  • Upload date:
  • Size: 5.0 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.0.3.tar.gz
Algorithm Hash digest
SHA256 2bb46531579aae44e73e248af48d9ddc0d12b55ab37796f217c32229539346b3
MD5 5808db37f699740104fff4589354f059
BLAKE2b-256 65ac211f8a3d52e8b3807e6072c5b13ee46a24a83bb895355a638e48be569908

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for discord_rich_presence-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 3de6dd0b71e15bfd3662876ce0d3b89eb577ab411513e142f8e8fe0258d1197b
MD5 03e558a883634d3320bb6639416003af
BLAKE2b-256 b384b9944b372c90224059da69a1fa4c763fc90b93ed0febd7e94fde159206fa

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