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.0.2.tar.gz
(16.8 kB
view details)
Built Distributions
File details
Details for the file discord-rpc.py-1.0.2.tar.gz
.
File metadata
- Download URL: discord-rpc.py-1.0.2.tar.gz
- Upload date:
- Size: 16.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 27e2b5fa05a92525098d892e5ce3ff76b5ef727240d42133d838078bfbaafb47 |
|
MD5 | 84de0ecbeab0d4d6d97759b11f2057be |
|
BLAKE2b-256 | 8ec2a970d6607c2b7e9a0d9a7182eed5902954ea536b8e08caf22b0b86a2a10e |
File details
Details for the file discord_rpc.py-1.0.2-py3-none-any.whl
.
File metadata
- Download URL: discord_rpc.py-1.0.2-py3-none-any.whl
- Upload date:
- Size: 24.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e46d3bb01f2c677a712ad8c2a0badbb093ba7806514a05a438c9ae45fabbdcf3 |
|
MD5 | 3f675604e59ba7cfbbbd9f7e2b802ab4 |
|
BLAKE2b-256 | 14ecc42a10e9cf70a0355678019b6cac0fcb23c9073e8f4cf5d88e52a51d8a58 |
File details
Details for the file discord_rpc.py-1.0.2-py2-none-any.whl
.
File metadata
- Download URL: discord_rpc.py-1.0.2-py2-none-any.whl
- Upload date:
- Size: 24.5 kB
- Tags: Python 2
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7774e10ce76bfcb68ca61fe0fd98d95b468935b24ed4e669c71af80d3ab9397d |
|
MD5 | 1870f20e2b8c7b2ebb3d2ff6e21fdc7e |
|
BLAKE2b-256 | 4955664adc90758b519bea07647d32ea63c7a8a6129e0cd2c587edb744a92c92 |