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.1.tar.gz
(19.5 kB
view hashes)
Built Distributions
Close
Hashes for discord_rpc.py-1.2.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 64151889f9d6f57efa47bb6a5429ababe23f09c72d8543a653d796ec1989bcc4 |
|
MD5 | 67ca5fb70d6def601daea39676359bbe |
|
BLAKE2b-256 | adc61e48d94dac76b1b6aa0135f0283ba41d9ca2e856da2b00610cc2162bf713 |
Close
Hashes for discord_rpc.py-1.2.1-py2-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c1dc5d688fba7106f1c2e64058e9f5f2e5173fba0b8152f36962cacf821d084a |
|
MD5 | 5d8576e587155d8d91f374b9a532d63c |
|
BLAKE2b-256 | 8f0390b4c1e2627322ca45e19452479d08e1e7af08fe840ae066a2fdfc5156bc |