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
Convenient script for trading with python.

Convenient script for trading with python.

VladKochetov007 66 Dec 07, 2022
Fully Automated Omegle Chatbot

omegle-bot tutorial features fast runs in background can run multiple instances at once Requirement Run this command in cmd, terminal or PowerShell (i

6 Aug 07, 2021
A fast, distributed, high performance gradient boosting (GBT, GBDT, GBRT, GBM or MART) framework based on decision tree algorithms, used for ranking, classification and many other machine learning tasks.

Light Gradient Boosting Machine LightGBM is a gradient boosting framework that uses tree based learning algorithms. It is designed to be distributed a

Microsoft 14.5k Jan 08, 2023
Discord Bot that leverages the idea of nested containers using podman, runs untrusted user input, executes Quantum Circuits, allows users to refer to the Qiskit Documentation, and provides the ability to search questions on the Quantum Computing StackExchange.

Discord Bot that leverages the idea of nested containers using podman, runs untrusted user input, executes Quantum Circuits, allows users to refer to the Qiskit Documentation, and provides the abilit

Mehul 23 Oct 18, 2022
PyHoroscope - Observational Indian lunisolar calendar, horoscope and matching using the Swiss ephemeris

PyHoroscope Observational Indian lunisolar calendar, horoscope and matching usin

4 Jun 05, 2022
A Discord bot made by QwertyIsCoding

QwertyBot QwertyBot A Discord bot made by QwertyIsCoding Explore the docs » View Demo . Report Bug . Request Feature About The Project This Discord bo

4 Oct 08, 2022
Best Buy Bot used to add products to cart for purchase.

To Install the Best Buy Bot These instructions are for Mac users only. Clone this Repo to your machine. BestBuyBot Open in VScode. Is Python installed

Robert Estrella 1 Dec 11, 2021
Python script using Twitter API to change user banner to see 100DaysOfCode process.

100DaysOfCode - Automatic Banners 👩‍💻 Adds a number to your twitter banner indicating the number of days you have in the #100DaysOfCode challenge Se

Ingrid Echeverri 10 Jul 06, 2022
Hacktoberfest2021 - Submit Just 4 PRs to earn SWAGS and Tshirts🔥

dont contribute in this repo, contribute only in below mentioned repo Special Note For Everyone ''' always make more then 4 pull request lets you have

Keshav Singh 820 Jan 02, 2023
Battle Pass farming tft bot

Tft bot Bot para farmar pontos do Passe de Batalha do TFT Descrição A cada partida de tft jogada você ganha 100 pontos no passe, porém você não precis

Leonardo Gonçalves 4 Jan 27, 2022
A discord bot to assist you when playing phasmophobia.

phasbot A discord bot to assist you when playing phasmophobia. Add phasbot to your server here! Bot Commands ?help - shows commands ?info [ghost name]

1 Dec 22, 2021
A plugin for modmail-bot for stealing,making ,etc emojis

EmojiPlugin for the Modmail-bot My first plugin .. its very Basic I will make more and better too Only 3 commands for now emojiadd-supports .jpg, .png

1 Dec 28, 2021
A synchronous, object oriented API wrapper for thecatapi

cats.py A synchronous, object oriented API wrapper for thecatapi Table Of Content cats.py Table Of Content Installation Usage Contributing FAQ License

Marcus 2 Feb 04, 2022
Hack WhatsApp Account Easily(Android)

X-Whatsapp Hack WhatsApp Account Easily(Android) HOW TO RUN 👇 (Termux) pkg update && pkg upgrade pkg install python pkg install git git clone https:/

KiLL3R_xRO 72 Dec 21, 2022
The Most Simple yet Powerful and Advanced Google Colab Notebook for Zip, Unzip, Tar, UnTar, RaR, UnRaR Files in Google Drive

The Most Simple yet Powerful and Advanced Google Colab Notebook for Zip, Unzip, Tar, UnTar, RaR, UnRaR Files in Google Drive

Dr.Caduceus 15 Aug 16, 2022
Console XMPP client in python

poezio Homepage: https://poez.io Forge Page: https://lab.louiz.org/poezio/poezio Poezio is a console Jabber/XMPP client. The initial goal was to provi

48 Dec 19, 2022
multi-purpose discord bot

virus multi-purpose discord bot ⚠️ WARNING This project is incomplete and may not work as expected. Download & Run Install Python =3.10 Clone the sou

miten 2 Jan 17, 2022
Automated endpoint management for Amazon Aurora Global Database

This sample code can be used to manage Aurora global database endpoints. After failover the global database writer endpoints swap from one region to the other. This solution automates creation and ma

AWS Samples 13 Dec 08, 2022
A python script that automatically farms the Discord bot 'Dank Memer'.

Dank Farmer A python script that automatically farms the Discord bot 'Dank Memer'. Requirements pynput Disclaimer DO NOT use if you are not willing to

2 Dec 30, 2021
Criando Lambda Functions para Ingerir Dados de APIs com AWS CDK

LIVE001 - AWS Lambda para Ingerir Dados de APIs Fazer o deploy de uma função lambda com infraestrutura como código Lambda vai numa API externa e extra

Andre Sionek 12 Nov 20, 2022