A powerful Discord Rich Presence library for Python
Reason this release was yanked:
should use the new version
Project description
hieuxyz-rpc
A powerful Discord Rich Presence library for Python. Note: This project is a Python port of the library @hieuxyz/rpc.
hieuxyz-rpc allows you to control the RPC status of a Discord User Account directly from Python. It supports advanced features like multi-RPC, client spoofing, custom assets, and buttons.
[!WARNING] I do not take responsibility for any blocked Discord accounts resulting from the use of this library.
[!CAUTION] Using this on a User Account is against the Discord Terms of Service (Self-botting) and may lead to account termination. By using this library, you accept the risk involved in exposing your Discord Token.
Installation
Install using pip:
pip install hieuxyz-rpc
Usage
Basic Example
import asyncio
import os
import time
from hieuxyz_rpc import Client, ClientOptions, logger
async def main():
token = "YOUR_DISCORD_USER_TOKEN"
# Initialize Client
client = Client(ClientOptions(
token=token,
always_reconnect=True
))
# Connect to Gateway
await client.run()
# Configure RPC
(client.rpc
.set_name('Visual Studio Code')
.set_details('Editing main.py')
.set_state('Workspace: hieuxyz-rpc')
.set_platform('desktop')
.set_type(0) # Playing
.set_timestamps(int(time.time() * 1000))
.set_party(1, 5)
.set_application_id('914622396630175855')
.set_large_image('python_icon', 'Python')
.set_small_image('vscode', 'VS Code')
.set_buttons([
{ 'label': 'View on GitHub', 'url': 'https://github.com/hieuxyz00/hieuxyz_rpc' },
{ 'label': 'View on PyPI', 'url': 'https://pypi.org/project/hieuxyz-rpc/' },
]))
# Send update to Discord
await client.rpc.build()
logger.info('Rich Presence updated!')
# Keep the script running
try:
while True:
await asyncio.sleep(3600)
except KeyboardInterrupt:
client.close(True)
if __name__ == '__main__':
asyncio.run(main())
Advanced Usage
Client Spoofing (Mobile/Console Status)
You can make it appear as though you are using Discord from a different device (e.g., smartphone, Xbox) by providing properties in ClientOptions.
from hieuxyz_rpc import Client, ClientOptions
client = Client(ClientOptions(
token="YOUR_TOKEN",
properties={
"os": "Android",
"browser": "Discord Android",
"device": "Android16"
}
))
Multi-RPC
You can display multiple statuses at once (e.g. Playing a game AND Listening to Spotify).
# Update default RPC
client.rpc.set_name("Coding").set_type(0) # Playing
# Create a second RPC instance
music_rpc = client.create_rpc()
music_rpc.set_name("Spotify") \
.set_details("Listening to Lo-Fi") \
.set_type(2) \
.set_application_id("12345678901234567") # Must use a different App ID
# Send all activities
await client.rpc.build()
API Reference
Class Client
Client(options: ClientOptions): Create a new instance.await client.run(): Connects to Discord Gateway.client.rpc: Access the defaultHieuxyzRPCbuilder.client.create_rpc(): Creates a newHieuxyzRPCinstance.client.close(force: bool): Closes the connection.
Class HieuxyzRPC
Builder class for Rich Presence. Methods are chainable.
.set_name(str): Activity name..set_details(str): Activity details..set_state(str): Activity state..set_status(str): Sets the user's presence status ('online' | 'dnd' | 'idle' | 'invisible' | 'offline')..set_type(int | str): 0/playing, 1/streaming, 2/listening, 3/watching, 5/competing..set_timestamps(start, end): Unix timestamps in ms..set_party(current, max, id): Set party size and ID..set_large_image(source, text):sourcecan be URL, Asset Key, orRpcImage..set_small_image(source, text): Same as above..set_buttons(list[dict]): List of{'label': '...', 'url': '...'}..add_button(label, url): Add a single button..set_application_id(str): Custom App ID..set_platform(str): 'desktop', 'android', 'ios', 'xbox', etc..set_flags(int): Set activity flags..set_secrets(dict): Set secrets for game invites..build() / .update_rpc(): Sends the payload to Discord..clear(): Resets the RPC state.
Author
- Developed by hieuxyz
- GitHub: @hieuxyz00
License
ISC License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hieuxyz_rpc-0.0.2.tar.gz.
File metadata
- Download URL: hieuxyz_rpc-0.0.2.tar.gz
- Upload date:
- Size: 19.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
028fac73ba6fb652bbfd1e4cfd457d91871828bab5081f5877982f237d7e7c90
|
|
| MD5 |
a128beaa8515267d1752f195ad62009b
|
|
| BLAKE2b-256 |
2993a50391beaad589c2ad48921f3a7a73aa0be1f64fb8477b872360a886f581
|
File details
Details for the file hieuxyz_rpc-0.0.2-py3-none-any.whl.
File metadata
- Download URL: hieuxyz_rpc-0.0.2-py3-none-any.whl
- Upload date:
- Size: 20.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ff3e6e07000362c86a0ca86c80719f8b7bb78714baa027f05b427e362f9bc2a5
|
|
| MD5 |
4ca197432baa600f37777c23e2cbac63
|
|
| BLAKE2b-256 |
9fb5c8a4e6ca178edfb452ea6d31d15cb253988dd29089e0a181da93e8b55932
|