A Discord Rich Presence library for Python 2 & 3
Project description
discord-rpc.py
A Discord RPC library for Python 2 & 3.
Installation
Install discord-rpc.py with pip
For the latest stable version:
pip install discord-rpc.py
For the latest development version:
git clone https://gitlab.com/somberdemise/discord-rpc.py
cd discord.py
python -m pip install -U .
Examples
import discord_rpc
import time
if __name__ == '__main__':
def readyCallback(current_user):
print('Our user: {}'.format(current_user))
def disconnectedCallback(codeno, codemsg):
print('Disconnected from Discord rich presence RPC. Code {}: {}'.format(
codeno, codemsg
))
def errorCallback(errno, errmsg):
print('An error occurred! Error {}: {}'.format(
errno, errmsg
))
# Note: 'event_name': callback
callbacks = {
'ready': readyCallback,
'disconnected': disconnectedCallback,
'error': errorCallback,
}
discord_rpc.initialize('token', callbacks=callbacks, log=False)
i = 0
start = time.time()
while i < 10:
i += 1
discord_rpc.update_presence(
**{
'details': 'Iteration # {}'.format(i),
'start_timestamp': start,
'large_image_key': 'default'
}
)
discord_rpc.update_connection()
time.sleep(2)
discord_rpc.run_callbacks()
discord_rpc.shutdown()
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-rpc.py-1.2.0.tar.gz
(19.5 kB
view hashes)
Built Distributions
Close
Hashes for discord_rpc.py-1.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eb23aa6176dda4daeeba13fc9a92e9e124885c4de04621960437903702853545 |
|
MD5 | 72b6b0227c827d3cf1ff867e15e79fa4 |
|
BLAKE2b-256 | 4ab0f2691cafad77fc08603b06b5ae4125ee2ac450e14d1b3764b658ac691bb0 |
Close
Hashes for discord_rpc.py-1.2.0-py2-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8d30e9d5a34aea7eae734e92411ada089778a443d9e8b4ad3a8599813a33b5d6 |
|
MD5 | 62dd013bcdd6e42db55769f1a3e05ce8 |
|
BLAKE2b-256 | b601999d98101bd47f6a7167bf26760483654fca4419e6a4777761811c885187 |