A Python wrapper for Discord RPC API

Overview

Visistors Discord PyPI - Downloads PyPI PyPI - Status GitHub commit activity

Discord RPC

An Python wrapper for Discord RPC API. Allow you to make own custom RPC

Changelog

Install

  • PyPI
pip install discord-rpc

Quick example

import DiscordRPC
import time 

rpc = DiscordRPC.RPC.Set_ID(app_id=12345678910)

rpc.set_activity(
      state="Rank : Radiant",
      details="Competitive",
      timestamp=rpc.timestamp()
    )

while True:
    time.sleep(600) # to update the RPC, recommended: every 10 minutes or 600 seconds

More examples here

Other

Plan
  • -

Join our Discord server here

Comments
  • Occasional crash

    Occasional crash

    Copy of #4 since @LyQuid12 won't reopen it.

    Sometimes when RPC.set_activity is called, the script crashes with error

        if output['evt'] == "ERROR":
    KeyError: 'evt'
    

    Adding debug print for RPC.output, the error is

    {'code': 1003, 'message': 'data size does not match what was received'}
    

    Seems to happen regardless of what the activity is set to.

    wontfix 
    opened by otta8634 2
  • Allow details and state to be null and disabling the logger

    Allow details and state to be null and disabling the logger

    The details and state fields are not actually required by Discord and it was a bit annoying being required to set them. As for the logger, most people probably won't want extra logging in their apps.

    merged 
    opened by Kale-Ko 2
  • Occasional crash

    Occasional crash

    Sometimes when RPC.set_activity is called, the script crashes with error

        if output['evt'] == "ERROR":
    KeyError: 'evt'
    

    Adding debug print for RPC.output, the error is

    {'code': 1003, 'message': 'data size does not match what was received'}
    

    Seems to happen regardless of what the activity is set to.

    opened by otta8634 2
  • Fixing bug for text and temporarily removing one function

    Fixing bug for text and temporarily removing one function

    I also temporarily removed GCAR because it caused issues on my end. And the small_text and large_text is now not shown as "null" in Discord if it did not got set.

    merged 
    opened by Pukimaa 2
  • What is the app_id and how to get it?

    What is the app_id and how to get it?

    https://github.com/LyQuid12/Discord-RPC/blob/main/examples/rpc-with-button.py#L3

    What is RPC and how it works?

    I have a bot written in python, but I'm not sure how to setup.

    The only thing I care about is custom buttons when opening bot's profile on Discord.

    Does activity have to be set to gaming? or other activities also can show the buttons or images?

    Is Discord-RPC like a second bot that other bots contact to receive information such as buttons and images?

    app_id seems like to mean client_id of a bot.

    Sorry, I'm really confused about how it all works.

    image

    opened by BoQsc 1
  • Explain rpc.run()

    Explain rpc.run()

    rpc.run() is only required to keep the application alive, which isn't explained in README.md. If another module or task or whatnot is keeping the script running, running rpc.run() will just cause the other script to stop functioning, if not threaded.

    merged 
    opened by otta8634 1
  • Error when compiled with pyinstaller

    Error when compiled with pyinstaller

    image

    I'm getting this error when trying to use your package after being compiled into an exe by pyinstaller.

    Here is my code

    rpc = DiscordRPC.RPC.Set_ID('Example')
    button = DiscordRPC.button(button_one_label='Server Invite', button_one_url="https://discord.gg/batch", button_two_label='Website', button_two_url='https://sped.lol')
    rpc.set_activity(state='test', details='test', large_image='WORKING_LARGE_IMAGE_KEY', large_text='test', buttons=button, timestamp=rpc.timestamp())
    rpc.run()
    

    It works perfectly fine as just a py file but when compiled it breaks

    opened by KDot227 1
  • Improvements

    Improvements

    So I've been trying to add a single button through this package and when I looked through the code I saw that there were some problems in it like, when we gave a single button it threw an error. So I myself decided to edit them and these are the things I edited:

    1. Support for single button.
    2. State and Details can now be ignored.
    3. Also Large_image, Small_Image, Small_Text and Large_Text can now be ignored.
    opened by INFINITE31 0
Releases(3.5)
  • 3.5(May 31, 2022)

  • 3.0(Jan 22, 2022)

    Stable

    New :

    • Added GCAR method. GCAR : Get Current Application Running. Basically, you can switch your rpc status (state/details) automatically to the application you're running (Example here)
    Source code(tar.gz)
    Source code(zip)
  • 2.0(Dec 14, 2021)

    Stable

    v2.0 has been released to PyPI, and has gone through the process of checking, testing and has been confirmed to be stable

    New & Updates :

    • Added button (Example here)
    • RPC output (Example here)
    • RPC still running even though "large_text" and "small_text" are not set
    • The message when RPC is running successfully is now working fine, and an error will appear if the RPC is not set properly
    Source code(tar.gz)
    Source code(zip)
  • 1.2(Dec 13, 2021)

Owner
LyQuid :3
Wibu
LyQuid :3
Acc-discord-rpc - Assetto Corsa Competizione Discord Rich Presence Client

A simple Assetto Corsa Competizione Rich Presence client. This app only works in

null 6 Dec 18, 2022
Discord-Wrapper - Discord Websocket Wrapper in python

This does not currently work and is in development Discord Websocket Wrapper in

null 3 Oct 25, 2022
Discord Rpc With Python And 2 Buttons

Discord-RPC-With-Python- Discord Rpc With Python And 2 Buttons Packages pypresence time Required Programs Python Latest Version Random IDE Discord :P

Kaz 4 Dec 12, 2021
Discord RPC for Notion written in Python

Discord RPC for Notion This is a program that allows you to add your Notion workspace activities to your Discord profile. This project is currently un

Thuliumitation 1 Feb 10, 2022
Pycord, a maintained fork of discord.py, is a python wrapper for the Discord API

pycord A fork of discord.py. PyCord is a modern, easy to use, feature-rich, and async ready API wrapper for Discord written in Python. Key Features Mo

Pycord Development 2.3k Dec 31, 2022
An asyncio Python wrapper around the Discord API, forked off of Rapptz's Discord.py.

Novus A modern, easy to use, feature-rich, and async ready API wrapper for Discord written in Python. A full fork of Rapptz's Discord.py library, with

Voxel Fox 60 Jan 3, 2023
PyDiscord, a maintained fork of discord.py, is a python wrapper for the Discord API.

discord.py A modern, easy to use, feature-rich, and async ready API wrapper for Discord written in Python. The Future of discord.py Please read the gi

Omkaar 1 Jan 16, 2022
An API wrapper for discord; maintained and improved from discord.py

Fusion.py Documentation What is Fusion.py you might ask; Fusion.py is a Discord.py fork that has most of the good features from most of the big Discor

Senarc Studios 5 Apr 19, 2022
EpikCord.py - This is an API Wrapper for Discord's API for Python

EpikCord.py - This is an API Wrapper for Discord's API for Python! We've decided not to fork discord.py and start completely from scratch for a new, better structuring system!

EpikHost 28 Oct 10, 2022
An API wrapper around Discord API.

NeoCord This project is work in progress not for production use. An asynchronous API wrapper around Discord API written in Python. Features Modern API

Izhar Ahmad 14 Jan 3, 2022
Aws-lambda-requests-wrapper - Request/Response wrapper for AWS Lambda with API Gateway

AWS Lambda Requests Wrapper Request/Response wrapper for AWS Lambda with API Gat

null 1 May 20, 2022
A Python wrapper for discord slash-commands, designed to extend discord.py.

dislash.py An extending library for discord.py that allows to build awesome slash-commands. ⭐

null 173 Dec 19, 2022
A Anything goes Discord bot written in python and uses the wrapper Discord.py

GerardTheWizard A Anything goes Discord bot written in python and uses the wrapper Discord.py What can he do? Allow users to level up through typing,

null 1 May 5, 2022
Library to manage your own custom RPC on your desktop

Info I don't recommend novices setting this up yourself. It requires Redis, a server to host the API on, and a bit of understanding of Windows & Pytho

Isaac K 1 Apr 16, 2022
Web3 Ethereum DeFi toolkit for smart contracts, Uniswap and PancakeSwap trades, Ethereum JSON-RPC utilities, wallets and automated test suites.

Web3 Ethereum Defi This project contains common Ethereum smart contracts and utilities, for trading, wallets,automated test suites and backend integra

Trading Strategy 222 Jan 4, 2023
Volt is yet another discord api wrapper for Python. It supports python 3.8 +

Volt Volt is yet another discord api wrapper for Python. It supports python 3.8 + How to install [Currently Not Supported.] pip install volt.py Speed

Minjun Kim (Lapis0875) 11 Nov 21, 2022
Kevin L. 3 Jul 14, 2022
An API wrapper for Discord written in Python.

discord.py A modern, easy to use, feature-rich, and async ready API wrapper for Discord written in Python. Key Features Modern Pythonic API using asyn

Danny 12k Jan 8, 2023
A wrapper for the Discord Python Pixels API.

DPYPX A simple wrapper around Python Discord Pixels. Requires Python 3.7+ (3.x where x >= 7). Requires pillow and aiohttp from pip. Example import dpy

Artemis 3 Oct 1, 2022