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.2.tar.gz
(19.5 kB
view details)
Built Distributions
File details
Details for the file discord-rpc.py-1.2.2.tar.gz
.
File metadata
- Download URL: discord-rpc.py-1.2.2.tar.gz
- Upload date:
- Size: 19.5 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 | e36d3a01bfc7bd70761d873098df25440a2efd5acd42a680b818e3f50bf8b6b3 |
|
MD5 | 1ec22c92007a5c197353f96e533cb61d |
|
BLAKE2b-256 | 8d9147af7695c187be26fca0af6c391885d325cf7d44d48b5eee8de7e7460e6e |
File details
Details for the file discord_rpc.py-1.2.2-py3-none-any.whl
.
File metadata
- Download URL: discord_rpc.py-1.2.2-py3-none-any.whl
- Upload date:
- Size: 27.2 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 | ae40b1d21d17151d2ed3ee905dc56b5c131ddce82c3f8a433587632b0caf4035 |
|
MD5 | 55c21ad775a830ed0d87ec8a6d85478f |
|
BLAKE2b-256 | 6b8f72aa09e31b140e2fe2bc2aa32b2b2e24b228ba5894beb09bc34e163478a3 |
File details
Details for the file discord_rpc.py-1.2.2-py2-none-any.whl
.
File metadata
- Download URL: discord_rpc.py-1.2.2-py2-none-any.whl
- Upload date:
- Size: 27.3 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 | 43285a6c0eef12232a10ed6c1ce8d0b0c79385c96bfe5aac1ba3c4daaac9c889 |
|
MD5 | 4f8231c1f9dddc3ce23b74c5dc64a139 |
|
BLAKE2b-256 | 61134b6c66074d667530ed467fea7ab2b73323089a188666f6ef2761759d3964 |