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
Simple integrate of API udemy.com with python

Pyudemy Simple integrate of API udemy.com with python Quick start $ pip install pyudemy or $ python setup.py install Authentication To make any calls

Hudson Brendon 30 Jan 02, 2023
TFT Bot that automatically surrenders and allows finishing TFT Passes easily.

Image Based TFT Bot TFT Bot that automatically surrenders and allows finishing TFT Passes easily. Please read full file! You can check new releases he

1 Feb 06, 2022
A discord Server Bot made with Python, This bot helps people feel better by inspiring them with motivational quotes or by responding with a great message, also the users of the server can create custom messages by telling the bot with Commands.

A discord Server Bot made with Python, This bot helps people feel better by inspiring them with motivational quotes or by responding with a great message, also the users of the server can create cust

Aran 1 Oct 13, 2021
Python version of PlaceNL's headless bot with automatic access token refresh

Reddit /r/place 2022 headless bot This headless Python bot will automatically login to reddit, obtain access tokens (and refreshes them when they expi

19 May 21, 2022
Technical Test - Python Programmer Grupo Nexxera

Technical Test Nexxera Group Teste TĆ©cnico - Grupo de Programadores Python Nexxera šŸ“ Prepare-se para usar a API Nossa API de transaƧƵes de contas dig

Raul dos Santos Moraes 1 Mar 16, 2022
This Mirror Bot is a multipurpose Telegram Bot writen in Python for mirroring files on the Internet to our beloved Google Drive.

MIRROR HUNTER This Mirror Bot is a multipurpose Telegram Bot writen in Python for mirroring files on the Internet to our beloved Google Drive. Repo la

anime republic 130 May 28, 2022
A Telegram Userbot to play Audio and Video songs / files in Telegram Voice Chats

TG-MusicPlayer A Telegram Userbot to play Audio and Video songs / files in Telegram Voice Chats. It's made with PyTgCalls and Pyrogram Requirements Py

4 Jul 30, 2022
UNLIMITED CALL AND SMS BOMBING PYTHON SCRIPT

cc_sim_crack v.1 An open-source SMS/call bomber for Linux And Termux. Note: Due misusing of cc_sim_crack, several API's died. Don't be afraid if you d

CYBER CRACKER OFFICIAL 3 Jul 05, 2021
A mass creator for Discord's new channel threads.

discord-thread-flooder A mass creator for Discord's new channel threads. (obv created by https://github.com/imvast) Warning: this may lag ur pc if u h

Vast 6 Nov 04, 2022
Python library for the eWarehousing Solutions API.

eWarehousing Solutions Python Library This library provides convenient access to the eWarehousing Solutions API from applications written in the Pytho

eWarehousing Solutions 2 Nov 09, 2022
Simple Telegram bot to confess to your crush this Valentine's Day

Simple Telegram bot to confess to your crush this Valentine's Day! Steps pip install python-telegram-bot Register a Telegram bot & get the token by fo

3 Mar 18, 2022
PS3API - PS3 API for TMAPI and CCAPI in python.

PS3API PS3 API for TMAPI and CCAPI in python. Examples Connecting and Attaching from ps3api import PS3API PS3 = PS3API(PS3API.API_TMAPI) if PS3.Conn

Adam 9 Sep 01, 2022
ZenML šŸ™: MLOps framework to create reproducible ML pipelines for production machine learning.

ZenML is an extensible, open-source MLOps framework to create production-ready machine learning pipelines. It has a simple, flexible syntax, is cloud and tool agnostic, and has interfaces/abstraction

ZenML 2.6k Dec 27, 2022
Azure DevOps Extension for Azure CLI

Azure DevOps Extension for Azure CLI The Azure DevOps Extension for Azure CLI adds Pipelines, Boards, Repos, Artifacts and DevOps commands to the Azur

1 Nov 03, 2021
Aws-cidr-finder - A Python CLI tool for finding unused CIDR blocks in AWS VPCs

aws-cidr-finder Overview An Example Installation Configuration Contributing Over

Cooper Walbrun 18 Jul 31, 2022
Unofficial instagram API, give you access to ALL instagram features (like, follow, upload photo and video and etc)! Write on python.

Instagram-API-python Unofficial Instagram API to give you access to ALL Instagram features (like, follow, upload photo and video, etc)! Written in Pyt

Vladimir Bezrukov 1 Nov 19, 2021
A modern, easy to use, feature-rich, and async ready API wrapper for Discord written in Python.

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

2 Feb 09, 2022
A melhor maneira de atender seus clientes no Telegram!

Clientes.Chat Sobre o serviƧo ConfiguraĆ§Ć£o Banco de Dados VariĆ”veis de Ambiente Docker Python Heroku ContribuiĆ§Ć£o Sobre o serviƧo A maneira mais organ

Gabriel R F 10 Oct 12, 2022
Discord bot that performs various functions.

rikka-bot A Discord bot that performs various functions. Table of Contents Commands Main Commands Utility Commands Admin Commands Self-Assignable Role

Carlos Saucedo 7 Aug 27, 2021
A small bot to interact with the reddit API. Get top viewers and update the sidebar widget.

LiveStream_Reddit_Bot Get top twitch and facebook stream viewers for a game and update the sidebar widget and old reddit sidebar to show your communit

Tristan Wise 1 Nov 21, 2021