Godot Rich Presence

by Weslei

33

Godot-Rich-Presence

Leia em português Brasil.

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.

Version

1.0.2

Engine

3.1

Category

Scripts

Download

Version1.0.2
Download

Support

If you need help or have questions about this plugin, please contact the author.

Contact Author