From b4d1cf23af174053bbc2b2f6a8e2f8bf561431ea Mon Sep 17 00:00:00 2001
From: jannuary <27908024+jannuary@users.noreply.github.com>
Date: Sat, 20 Sep 2025 15:02:23 +0700
Subject: [PATCH 1/2] Add some missing types
---
discordrpc/presence.py | 11 +++++++----
discordrpc/types.py | 5 +++++
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/discordrpc/presence.py b/discordrpc/presence.py
index c8ebfee..09db516 100644
--- a/discordrpc/presence.py
+++ b/discordrpc/presence.py
@@ -56,10 +56,10 @@ def _setup(self):
def set_activity(
self,
- state: str=None, details:str=None, act_type:Activity=Activity.Playing,
+ state: str=None, details:str=None, act_type:Activity=Activity.Playing, status_type:StatusDisplay=StatusDisplay.Name,
ts_start:int=None, ts_end:int=None,
- large_image:str=None, large_text:str=None,
- small_image:str=None, small_text:str=None,
+ large_image:str=None, large_text:str=None, large_url:str=None,
+ small_image:str=None, small_text:str=None, small_url:str=None,
party_id:str=None, party_size:list=None,
join_secret:str=None, spectate_secret:str=None,
match_secret:str=None, buttons:list=None
@@ -82,6 +82,7 @@ def set_activity(
"state": state,
"details": details,
"type": act_type.value,
+ "status_display_type": status_type.value,
"timestamps": {
"start": ts_start,
"end": ts_end
@@ -89,8 +90,10 @@ def set_activity(
"assets": {
"large_image": large_image,
"large_text": large_text,
+ "large_url": large_url,
"small_image": small_image,
- "small_text": small_text
+ "small_text": small_text,
+ "small_url": small_url
},
"party": {
"id": party_id,
diff --git a/discordrpc/types.py b/discordrpc/types.py
index 31251c0..b4968a9 100644
--- a/discordrpc/types.py
+++ b/discordrpc/types.py
@@ -10,3 +10,8 @@ class Activity(Enum):
Watching = 3
Custom = 4
Competing = 5
+
+class StatusDisplay(Enum):
+ Name = 0
+ State = 1
+ Details = 2
\ No newline at end of file
From 91e2f703f09b01acf523856c1ddfea4bf628473e Mon Sep 17 00:00:00 2001
From: jannuary <27908024+jannuary@users.noreply.github.com>
Date: Sat, 20 Sep 2025 15:25:01 +0700
Subject: [PATCH 2/2] Update DOCS.md
---
DOCS.md | 59 +++++++++++++++++++++++++++++++++++----------------------
1 file changed, 36 insertions(+), 23 deletions(-)
diff --git a/DOCS.md b/DOCS.md
index 4d44507..97d0c65 100644
--- a/DOCS.md
+++ b/DOCS.md
@@ -41,7 +41,7 @@ Step-by-step making simple rich presence using Discord-RPC.
import discordrpc
```
-3. Creating `rpc` variable from `discordrpc.RPC`. And insert your app ID ([Tutorial](#getting-application-id)).
+3. Creating `rpc` variable from `discordrpc.RPC` with your unique ([Application ID](#getting-application-id)).
```py
rpc = discordrpc.RPC(app_id=1234) #Change app_id to your app id
```
@@ -66,45 +66,50 @@ Step-by-step making simple rich presence using Discord-RPC.
Examples can be seen in the repository (`Discord-RPC/examples`) or [here](https://github.com/Senophyx/Discord-RPC/tree/main/examples).
-## **All class and function**
+## **All classes and functions**
## class `discordrpc.RPC()`
- `discordrpc.RPC()`
Parameters :
- app_id (`int`) : Application ID ([Tutorial](#getting-application-id))
- - debug (`bool`) : Print more informative output. Default = False
- - output (`bool`) : Print output or not. Default = True
+ - debug (`bool`) : Whether to include debug information in the output. Default = False
+ - output (`bool`) : Whether to print the output. Default = True
- exit_on_disconnect (`bool`) : Whether to quit program when disconnecting. Default = True
- method `RPC.set_activity()`
Set activity to be displayed on the user's Discord profile.
+ See [Activity Object](https://discord.com/developers/docs/events/gateway-events#activity-object) Discord documentation page for more details.
+ Keep in mind that not every field is currently implemented.
Parameters :
- - state (`str`)
- - details (`str`)
- - act_type (`discordrpc.Activity`) : [Activity Types](https://discord.com/developers/docs/topics/gateway-events#activity-object-activity-types) (Activity Type `1` and `4` is currently disabled, see [#28](https://github.com/Senophyx/Discord-RPC/issues/28#issuecomment-2301287350)).
- - ts_start (`int`) : Timestamp start.
- - ts_end (`int`) : Timestamp end.
- - large_image (`str`) : The name of the image that has been uploaded to the Discord Developer Portal.
- - large_text (`str`) : Text when user hover to `large_image`.
- - small_image (`str`) : The name of the image that has been uploaded to the Discord Developer Portal.
- - small_text (`str`) : Text when user hover to `small_image`.
- - party_id (`int`) : id of the user’s party.
- - party_size (`list`) : party size in list with format `[current_size, max_size]` or `[1, 10]`.
+ - state (`str`) - Describes user's current party status.
+ - details (`str`) - Describes what the player is currently doing.
+ - act_type (`discordrpc.Activity`) : An [Activity Type](https://discord.com/developers/docs/topics/gateway-events#activity-object-activity-types). Controls how the user's activity is described in their status (e.g. Playing Foo, Listening to Foo). (`Streaming` and `Custom` are currently disabled, see [#28](https://github.com/Senophyx/Discord-RPC/issues/28#issuecomment-2301287350))
+ - status_type (`discordrpc.StatusDisplay`) : A [Status Display Type](https://discord.com/developers/docs/events/gateway-events#activity-object-status-display-types). Controls what is displayed in the user's activity status (e.g. Listening to Foo, Listening to Bar)
+ - ts_start (`int`) : Timestamp representing the start time of an activity. Represented in UNIX epoch time, in seconds.
+ - ts_end (`int`) : Timestamp representing the end time of an activity. Represented in UNIX epoch time, in seconds. When specified, a progress bar is displayed going from `ts_start` to `ts_end`.
+ - large_image (`str`) : Either a unique name of an asset in your application, or a URL to an image. See [Activity Asset Image](https://discord.com/developers/docs/events/gateway-events#activity-object-activity-asset-image).
+ - large_text (`str`) : Text shown when hovering over `large_image`.
+ - large_url (`str`) : URL opened when clicking on `large_image`.
+ - small_image (`str`) : Either a unique name of an asset in your application, or a URL to an image. See [Activity Asset Image](https://discord.com/developers/docs/events/gateway-events#activity-object-activity-asset-image).
+ - small_text (`str`) : Text shown when hovering over `small_image`.
+ - small_url (`str`) : URL opened when clicking on `small_url`.
+ - party_id (`int`) : ID of the user’s party.
+ - party_size (`list`) : Party size in list with format `[current_size, max_size]` or `[1, 10]`.
- join_secret (`str`) : Secret for chat invitations and ask to join button.
- spectate_secret (`str`) : Secret for spectate button.
- - match_secret (`str`) : Secret for for spectate and join button
- - buttons (`list`) : list of dicts for buttons on user's profile. You can use `discordrpc.Button` for more easier.
+ - match_secret (`str`) : Secret for for spectate and join button.
+ - buttons (`list`) : A `list` of `dicts` for buttons on user's profile. A helper object `discordrpc.Button(text:str, url:str)` is provided.
- Return : `True` if rpc successfully connected.
+ Returns : `True` if RPC successfully connected.
- method `RPC.disconnect()`
Disconnecting and closing RPC socket.
- Return : nothing.
+ Returns : `None`.
- method `RPC.run()`
- Keeping rpc alive. Not required if another tasks is running on the same file.
+ Keeping the RPC alive. Not required if another tasks is running on the same file.
Parameters :
- update_every (`int`) : `time.sleep` every inputed second.
@@ -112,7 +117,7 @@ Examples can be seen in the repository (`Discord-RPC/examples`) or [here](https:
Exceptions :
- `KeyboardInterrupt` will call `RPC.disconnect`.
- Return : nothing.
+ Returns : `None`.
- variable `self.is_connected`
Check whether the RPC successfully handshaked and connected to the Discord socket.
@@ -138,9 +143,17 @@ Examples can be seen in the repository (`Discord-RPC/examples`) or [here](https:
- Competing
> [!NOTE]
-> Activity Type `Streaming` and `Custom` currently disabled.
+> Types `Streaming` and `Custom` are currently disabled.
> [Details](https://github.com/Senophyx/Discord-RPC/issues/28#issuecomment-2301287350)
+## class `discordrpc.Activity`
+- Enum `StatusDisplay`
+ Simplified StatusDisplay type payload in `RPC.set_activity`
+
+ Available values :
+ - Name
+ - State
+ - Details
## class `discordrpc.Button()`
- function `Button()`
@@ -150,7 +163,7 @@ Examples can be seen in the repository (`Discord-RPC/examples`) or [here](https:
- text (`test`)
- text (`url`)
- Return : Payload dict.
+ Returns : Payload dict.
> [!NOTE]
> Discord does not display buttons in your own Activity.