Giter Club home page Giter Club logo

godot-rich-presence's Introduction

Godot-Rich-Presence

Godot Rich Presence is a lib made with GDNative to use rich presence do Discord in Godot engine 3.1.

Rich Presence

Functions

init(Dictionary initialize)

Receives a dict with following keys:

key optional description default
app_id no id of your discord app -
auto_register yes whether or not to register an application protocol for your game on the player's computer — necessary to launch games from Discord 1
steam_id yes your game's Steam application id, if your game is distributed on Steam null

More information in Initialization

update(Dictionary presence)

Update the presence, receives a dict with following keys:

key type description
state string the current player state
details string what the player is doing
start_timestamp int when the game started, it will show elapsed
end_timestamp int when the game will end, it will show remaining
large_image_key string name of the uploaded image for the large profile artwork
large_image_text string tooltip for the large_image_key
small_image_key string name of the uploaded image for the small profile artwork
small_image_text string tootltip for the small_image_key
party_id string id of the player's lobby/group/party
party_size int current size of the player's lobby/group/party
party_max int max size of the player's lobby/group/party
spectate_secret string unique hashed string for Spectate button
join_secret string unique hashed string for Ask to join

OBS., to use party_size you need set party_max and vice-versa.

More information in Updating Presence and Rich Presence Field Requirements

clear()

Reset the presence

reply(String userId, int response)

Responds a request to join in the match, possible answers:

response code
NO 0
YES 1
IGNORE 2

More information in Ask to join

run_callbacks()

The Discord-rpc callback will only be called when this function is called, create a timer to exec this function in a interval of time. More information in So, how does it work?

shutdown()

Shutdown Rich Presence

Callbacks discord-rpc

It's possible define some signals to discord-rpc events, when the discord-rpc callbacks are called a signal will be emitted, the signals are:

signal arguments
ready dict user
disconnected int error_code, string message
error int error_code, string message
join_game string secret
join_request dict request
spectate_game string secret

ready and join_request receives a dict with following keys:

key description
user_id id of player's discord account
username
discriminator discord discriminator (e.g 2077)
avatar avatar's hash

OBS., I tried only the events ready and error, I believe the others works too.

More information in So, how does it work?

How to use?

The example folder has a simple example of how to use it.

Compiling

Clone this repo and then clone the following repositories:

Make sure the directory looks like:

godot-cpp
discord-rpc
Godot-Rich-Presence
├── example/
└── src/

Run SConstruct using the command scons platform=plataforma arch=64, the compiled files will be in bin folder.

godot-rich-presence's People

Contributors

wesleiramos 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.