Discord-RPC
An Python wrapper for Discord RPC
Discord RPC #
An Python wrapper for Discord RPC API. Allow you to make own custom RPC.
Install #
- PyPI
pip install discord-rpc
Quick example #
import discordrpc
rpc = discordrpc.RPC(app_id=12345678910)
rpc.set_activity(
state="A super simple rpc",
details="simple RPC"
)
# Required if you only run Discord RPC on this file or current instance.
rpc.run()
rpc.run() is only used if you are only running Discord RPC on the current file/instance. If there are other programs/tasks on the current instance, rpc.run() does not need to be used.
See documentation here.
More examples here.
Changelog #
5.5 #
- PEP 621: Migrating from
setup.pytopyproject.tomlby in #0ffaca5 - feat: rewrite Button, added new ActivityType class, fix minor issues by @SuperZombi in #49
- Add new types and params by @SuperZombi in #50
- Add some missing types by @jannuary in #53
5.1 #
Updates :
- Added Activity Types (Listening, Watching, etc).
rpc.set_activity(act_type=0)
- Added more detailed information in the output.
5.0 #
Critical updates & changes :
- Inputting id is no longer in
RPC.set_id. Replaced with inputing insideRPCclass.
Before:
rpc = discordrpc.RPC.set_id(app_id=1234567890)
After:
rpc = discordrpc.RPC(app_id=1234567890)
Updates :
Removing many functions. List:
RPC.set_idRPC._connectRPC._writeRPC._recvRPC._recv_exact- And many more…
Package
loggingis used again as output.Removing
timestampargument and addedts_startandts_endonset_activity()as a replacement for the timestamp argument.Added
debugparameter onRPCclass if you want to print more outputs.timestampvariable is moved todiscordrpc.utils. So if you want to import timestamp variable, usefrom discordrpc.utils import timestampbuttonondiscordrpc.buttonchanged toButton.added
date_to_timestampfunction ondiscordrpc.utils. with format%d/%m/%Y-%H:%M:%Sorday/month/year-hour:minute:secondExample :date_to_timestamp('14/06/2025-00:00:00')
4.0 #
Critical update :
- Changing
DiscordRPCfolder (when you import the package) todiscordrpc. Before :
import DiscordRPC
After :
import discordrpc
Updates :
- No longer using
loggingpackage. GCARorget_current_application_runningremoved because it can’t be cross-platform (I spent days just looking for this solution lmao).setLoggerEnabled()function removed.Set_IDchanged toset_id.output()function changed toshow_outputvariable, Example.- Shorten the code in
presence.py(not that much though).
3.0 #
New & Updates :
- Added
GCARmethod. GCAR : Get Current Application Running. Basically, you can switch your rpc status (state/details) automatically to the application you’re running
2.0 #
New & Updates :