GithubHelp home page GithubHelp logo

negocki / pydiscordrpc Goto Github PK

View Code? Open in Web Editor NEW

This project forked from derpychap/pydiscordrpc

0.0 1.0 0.0 17 KB

Original code by GiovanniMCMXCIX. Importable Discord RPC script for your own projects.

License: MIT License

Python 100.00%

pydiscordrpc's Introduction

PyDiscordRPC

Originally created by GiovanniMCMXCIX, this script has been modified so that you can easily import it into your own Python projects (It could definately be improved for sure). For more information on Discord's Rich Presence feature, look here: https://discordapp.com/developers/docs/rich-presence/best-practices

How To Use

Here's a quick example script on how to use this module:

import rpc
import time

client_id = '1234567892138470' #Your application's client ID as a string. (This isn't a real client ID)
RPC = rpc.DiscordRPC(client_id) #Send the client ID to the rpc module
RPC.start() #Start the RPC connection

current_time = time.time()

#This is the activity information sent to the client
activity = {
    "state": "This is the state",
    "details": "Here are some details",
    "timestamps": {
        "start": int(current_time)
    },
    "assets": {
        "small_text": "Text for small_image",
        "small_image": "img_small",
        "large_text": "Text for large_image",
        "large_image": "img_large"
    },
    "party": {
        "size": [1, 6]
    }
}

RPC.send_rich_presence(activity)
time.sleep(60)
 #Presence is set for 60 seconds, afterwards the script will end and the presence will disappear from your profile.

You can see a more practical use where I use this to report to Discord the song I have playing in Winamp here.

pydiscordrpc's People

Contributors

giovannimcmxcix avatar derpychap avatar

Watchers

Karol T avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.