discord-rich-presence


Namediscord-rich-presence JSON
Version 1.1.0 PyPI version JSON
download
home_pagehttps://github.com/TenType/discord-rich-presence
SummaryA lightweight and safe module for creating custom rich presences on Discord.
upload_time2023-07-24 22:12:27
maintainer
docs_urlNone
authorTenType
requires_python>=3.9
licenseMIT
keywords discord presence rich presence activity rpc
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # discord-rich-presence
A lightweight and safe package for creating custom rich presences on Discord.

## Example
![Discord Rich Presence Example](/examples/example.jpg)

## How to Use

### Making a Discord App
1. Create an app by clicking "New Application" in the [Discord Developers Portal](https://discord.com/developers/applications).
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
4. Install the latest version of [Python](https://www.python.org/downloads/) if you haven't already.
5. 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
6. Create a file ending in `.py`, and paste in the following example from [examples/simple.py](examples/simple.py):
```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.

7. 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](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](https://discord.com/developers/docs/topics/gateway-events#activity-object).
- **`ClientIDError`**: Verify that your client ID is valid.
- **`PresenceError`**: Read the [Discord docs](https://discord.com/developers/docs/topics/opcodes-and-status-codes#rpc) 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.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/TenType/discord-rich-presence",
    "name": "discord-rich-presence",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": "",
    "keywords": "discord,presence,rich presence,activity,rpc",
    "author": "TenType",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/99/5c/476e00d8fa145c29db353c3d6c9d936c146b4461c12310154420d3ca4211/discord-rich-presence-1.1.0.tar.gz",
    "platform": null,
    "description": "# discord-rich-presence\nA lightweight and safe package for creating custom rich presences on Discord.\n\n## Example\n![Discord Rich Presence Example](/examples/example.jpg)\n\n## How to Use\n\n### Making a Discord App\n1. Create an app by clicking \"New Application\" in the [Discord Developers Portal](https://discord.com/developers/applications).\n2. Give your app a name and an icon (this can be changed later). Make sure to save your changes.\n    - **Optional:** Go to \"Rich Presence\", and add a few images under the \"Rich Presence Assets\" section.\n3. Under \"Application Id\" in the \"General Information\" tab, copy your app's id.\n\n### Installation\n4. Install the latest version of [Python](https://www.python.org/downloads/) if you haven't already.\n5. Run the following in your terminal:\n```\n$ pip install discord-rich-presence\n```\nIf all goes well, it should say something like \"Successfully installed discord-rich-presence\".\n\n### Writing the Code\n6. Create a file ending in `.py`, and paste in the following example from [examples/simple.py](examples/simple.py):\n```py\nfrom discordrp import Presence\nimport time\n\nclient_id = \"000000000000000000\"  # Replace this with your own client id\n\nwith Presence(client_id) as presence:\n    print(\"Connected\")\n    presence.set(\n        {\n            \"state\": \"In Game\",\n            \"details\": \"Summoner's Rift\",\n            \"timestamps\": {\"start\": int(time.time())},\n        }\n    )\n    print(\"Presence updated\")\n\n    while True:\n        time.sleep(15)\n```\nMake sure you replace the `client_id` variable with your app's id that you copied earlier.\n\n7. 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](examples/complex.py) for another example.\n\n## Troubleshooting\nHere are the most common errors:\n- **`ActivityError`**: An incorrect dictionary was passed to `Presence.set`. Make sure that it matches the [format expected by Discord](https://discord.com/developers/docs/topics/gateway-events#activity-object).\n- **`ClientIDError`**: Verify that your client ID is valid.\n- **`PresenceError`**: Read the [Discord docs](https://discord.com/developers/docs/topics/opcodes-and-status-codes#rpc) for more information.\n- **`ConnectionRefusedError` or `FileNotFoundError`**: Make sure that your Discord application is open and logged in.\n- **Program hangs for a long time and does not set the presence**: Wait for at least 10 seconds before closing and trying again.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A lightweight and safe module for creating custom rich presences on Discord.",
    "version": "1.1.0",
    "project_urls": {
        "Homepage": "https://github.com/TenType/discord-rich-presence"
    },
    "split_keywords": [
        "discord",
        "presence",
        "rich presence",
        "activity",
        "rpc"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b373cd32e23cb17fb328097b7bc916c535e38e2c8f7b79844fc6d67c0e6d5de7",
                "md5": "010da6c041f0d5fe905e42138b4cbdf4",
                "sha256": "4b8d2e6e68e8f70df2547847f5dbf5a2cb1e6a7ab394e277c6fabee5c705c19a"
            },
            "downloads": -1,
            "filename": "discord_rich_presence-1.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "010da6c041f0d5fe905e42138b4cbdf4",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 6241,
            "upload_time": "2023-07-24T22:12:25",
            "upload_time_iso_8601": "2023-07-24T22:12:25.681283Z",
            "url": "https://files.pythonhosted.org/packages/b3/73/cd32e23cb17fb328097b7bc916c535e38e2c8f7b79844fc6d67c0e6d5de7/discord_rich_presence-1.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "995c476e00d8fa145c29db353c3d6c9d936c146b4461c12310154420d3ca4211",
                "md5": "63e5aa050f8ad1bb1e75dc910cddf650",
                "sha256": "58fb1601cc65cf4f7bf6e1225b924df716fca7f0755afe2eb66d25c2cb3cf480"
            },
            "downloads": -1,
            "filename": "discord-rich-presence-1.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "63e5aa050f8ad1bb1e75dc910cddf650",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 5512,
            "upload_time": "2023-07-24T22:12:27",
            "upload_time_iso_8601": "2023-07-24T22:12:27.135716Z",
            "url": "https://files.pythonhosted.org/packages/99/5c/476e00d8fa145c29db353c3d6c9d936c146b4461c12310154420d3ca4211/discord-rich-presence-1.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-24 22:12:27",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "TenType",
    "github_project": "discord-rich-presence",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "discord-rich-presence"
}
        
Elapsed time: 0.10088s