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
PR Changes Matrix Builder

Pr-changes-matrix-builder - A Github Action that will output a variable to be used in a matrix strategy job based on a PR&'s changes

Kyle James Walker (he/him) 21 Oct 04, 2022
Simple debugger and tester for dico-command.

dp Simple debugger and tester for dico-command. Installation pip install -U dico-dp Usage bot = dico_command.Bot(...) ... bot.load_module("dp") Comma

3 Nov 19, 2022
This is a crypto trading bot that scans the Binance Annoucements page for new coins, and places trades on Gateio

gateio-trading-bot-binance-announcements This Gateio x Binance cryptocurrency trading bot scans the Binance Announcements page and picks up on new coi

Andrei 1.2k Jan 01, 2023
A discord bot with information and template tracking for pxls.space.

pyCharity A discord bot with information and template tracking for pxls.space. Inspired by Mikarific's Charity bot. Try out the beta version on your s

1 Dec 03, 2021
Pdisk Link Converter Telegram Bot, Convert link in a single click

Pdisk Converter Bot Make short link by using Pdisk API key Installation The Easy Way Required Variables BOT_TOKEN: Create a bot using @BotFather, and

Ayush Kumar Jaiswal 6 Jul 28, 2022
👨‍💼Linkedin API for Python

linkedin_api 👨‍💼 Linkedin API for Python No "official" API access required - just use a valid Linkedin account! Programmatically send messages, get

Tom Quirk 918 Dec 29, 2022
Wrapper for wttr.in weather forecast.

pywttr Wrapper for wttr.in weather forecast. Asynchronous version here. Installation pip install pywttr Example This example prints the average temper

Almaz 6 Dec 25, 2022
Apps related to Odoo it's calendar features

calendar Apps related to Odoo it's calendar/appointments features: online_appointment_locations: allow setting an online URL per employee online_appoi

Yenthe Van Ginneken 3 Oct 27, 2022
SimpleTelegramScraper - A python script scrapes accounts from public groups via Telegram API and saves them in a CSV file

SimpleTelegramScraper - the best scraper on GitHub This simple python script scr

Deniz Shabani 12 Oct 06, 2022
Скрипт, позволяющий импортировать плейлисты из Spotify, а также обычные треклисты в VK музыку.

vk-music-import Программа для переноса плейлистов из Spotify и текстовых треклистов в VK Музыку. Преимущества: Позволяет быстро импортировать плейлист

Mew Forest 32 Nov 23, 2022
Download videos from Youtube and other platforms through a Telegram Bot

ytdl-bot Download videos from YouTube and other platforms through a Telegram Bot Usage: https://t.me/benny_ytdlbot Send link from YouTube directly to

Telegram Bot Collection 289 Jan 03, 2023
Filters to block and remove copycat-websites from DuckDuckGo and Google

uBlock Origin - Shitty Copy-Paste websites filter Filter for uBlock origin to remove spam-website results from DuckDuckGo and Google that just blatant

99 Dec 15, 2022
The open source version of Tentro - A multipurpose Discord bot.

Welcome to Tentro 👋 A multipurpose Discord bot. 🏠 Homepage Install pip install -r requirements.txt Usage py Tentro.py Contributors 👤 Tentro Dev Tea

6 Jul 14, 2022
Yes, it's true :heartbeat: This repository has 337 stars.

Yes, it's true! Inspired by a similar repository from @RealPeha, but implemented using a webhook on AWS Lambda and API Gateway, so it's serverless! If

512 Jan 01, 2023
A simple telegram bot to download from Zee5 links

Zee5 Downloader If you find any bugs, report at @TroJanzSupport My Features: 👉 Upload as file/video from any NON-DRM Zee5 link 👉 Permanent thumbnail

TroJanzHEX 95 Dec 20, 2022
:globe_with_meridians: A Python wrapper for the Geocodio geolocation service API

Py-Geocodio Python wrapper for Geocodio geocoding API. Full documentation on Read the Docs. If you are upgrading from a version prior to 0.2.0 please

Ben Lopatin 84 Aug 02, 2022
This is an implementation example of a bot that periodically sends predictions to the alphasea-agent.

alphasea-example-model alphasea-example-modelは、 alphasea-agent に対して毎ラウンド、予測を投稿するプログラムです。 Numeraiのexample modelに相当します。 準備 alphasea-example-modelの動作には、

AlphaSea 11 Jul 28, 2022
Passive income method via SerpClix. Uses a bot to accept clicks.

SerpClixBotSearcher This bot allows you to get passive income from SerpClix. Each click is usually $0.10 (sometimes $0.05 if offer isnt from the US).

Jason Mei 3 Sep 01, 2021
A Bot to Upload files to Many Cloud services. Powered by Telethon.

oVo MultiUpload V1.0 👀 A Bot to Upload files to Many Cloud services. Powered by Telethon _ 🎯 Follow me and star this repo for more telegram bots. @H

32 Dec 30, 2022
Aria/qBittorrent Telegram mirror/leech bot

This Telegram Bot written in Python for mirroring files on the Internet to our Google Drive or Telegram. Based on python-aria-mirror-bot Features: qBi

Anas 2.1k Jan 04, 2023