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.3.0.tar.gz
(20.4 kB
view details)
Built Distributions
File details
Details for the file discord-rpc.py-1.3.0.tar.gz
.
File metadata
- Download URL: discord-rpc.py-1.3.0.tar.gz
- Upload date:
- Size: 20.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.8.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2301ffb59f7964e31fbac3c2fc35944532c452d6b6d806b2a0b30f422a8a6679 |
|
MD5 | be224d20cf078d6664d1b7dfdb23880a |
|
BLAKE2b-256 | 7ee1277990bd0a46d0b036b7678d489095805453872e776dfff633f704030562 |
File details
Details for the file discord_rpc.py-1.3.0-py3-none-any.whl
.
File metadata
- Download URL: discord_rpc.py-1.3.0-py3-none-any.whl
- Upload date:
- Size: 27.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.8.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 289c3d77893c0d74acad872eb87a51a6492e20c052553525edf78963fb31bf3d |
|
MD5 | 0f6af1b913546d3f98be8f8453d3709b |
|
BLAKE2b-256 | 75bdb1f111ea2eed1a42bcb59cc564e108f27b3be543fb4d322be7e807a1872b |
File details
Details for the file discord_rpc.py-1.3.0-py2-none-any.whl
.
File metadata
- Download URL: discord_rpc.py-1.3.0-py2-none-any.whl
- Upload date:
- Size: 27.5 kB
- Tags: Python 2
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.8.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9017a5884c536aa4cf7dde574ec75dad162caae5b68a219f9375417653ffb063 |
|
MD5 | 6c36bb755fc42f2953c75604b566ef58 |
|
BLAKE2b-256 | 4ac2475ded1b3b101fd57d1dbd0b6da086ed7cd4cafaec29fee1530c44cdc56b |