Metadata-Version: 2.4
Name: discord-rpc.py
Version: 1.2.2
Summary: A Discord Rich Presence library for Python 2 & 3
Home-page: https://gitlab.com/somberdemise/discord-rpc.py
Author: Gustavo (somberdemise)
Author-email: me@gustavo.dev
License: Mozilla Public License 2.0 (MPL 2.0)
Platform: Windows
Platform: Linux
Platform: OSX
Classifier: Development Status :: 5 - Production/Stable
Classifier: License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX :: Linux
Classifier: Operating System :: MacOS :: MacOS X
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Software Development :: Libraries
Description-Content-Type: text/markdown
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: license
Dynamic: platform
Dynamic: summary

# 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:

```python
git clone https://gitlab.com/somberdemise/discord-rpc.py
cd discord.py
python -m pip install -U .
```

# Examples

```python
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()

```
