Skip to content

Activities

Variables

Anything of course begins with DiscordRPC. e.g. DiscordRPC.app_id = #<your Application ID>

Rich presence

NameTypeDescription
app_idintThe Application ID you need to get to make anything in the plugin → https://discord.com/developers/applications
detailsStringThe first text line visible in the Activity (after the app name)
stateStringThe second text line visible in the Activity
large_imageStringKey for the large image you set while uploading an image to the “Rich Presence” → “Art Assets” tab in your online Discord dev panel
large_image_textStringText wich shows when you hover over the large image
small_imageStringKey for the small image you set while uploading an image to the “Rich Presence” → “Art Assets” tab in your online Discord dev panel
small_image_textStringText wich shows when you hover over the small image
start_timestampintThe “02:46 elapsed” timestamp in the presence. Get the current time with Godot’s int(Time.get_unix_time_from_system()) and Discord counts in seconds from it
end_timestampintThe “59:59 elapsed” timestamp in the presence. Get it with Godot’s int(Time.get_unix_time_from_system()) and add seconds as int e.g. + 3600 → + 1 Hour

Invite system

The values can be pretty anything since there is no lobby system in the SDK anymore. You should already have a custom lobby system wich can compute the secret and change the values. After an invite every value should be the same as the other player.

NameTypeDescription
party_idStringUnique identifier for the party
current_party_sizeintThe current playercount in the party
max_party_sizeintMaximum allowed playercount in the party
match_secretStringUnique hash for the given match context
join_secretString Unique hash for chat invites and Ask to Join
spectate_secretStringUnique hash for Spectate button
is_public_partyboolTurn it to true if you want people to join the party without asking. This needs to be enabled in the Discord user settings
instancedboolWhether this activity is an instanced context, like a match

Signals

Invite system

Activity join request

Connect it with:

DiscordRPC.connect("activity_join_request",_on_activity_join_request)

Add it in your gdscript as function:

func _on_activity_join_request(user_requesting):

The Signal fires when someone requests to join your Activity via an request join button in Discord.
Given variable: Dictionary user_requesting


Activity join

Connect it with:

DiscordRPC.connect("activity_join",_on_activity_join)

Add it in your gdscript as function:

func _on_activity_join(secret):

The Signal fires when someone joins your Activity via an invite or join button in Discord.
Given variable: String secret
Send the secret to your custom system to generate the other party values and make them the same as the target user.


Activity spectate

Connect it with:

DiscordRPC.connect("activity_spectate",_on_activity_spectate)

Add it in your gdscript as function:

func _on_activity_spectate(secret):

The Signal fires when someone spectates your Activity via an invite or spectate button in Discord.
Given variable: String secret
Send the secret to your custom system to generate the other party values and make them the same as the target user.

Methods

Refresh

After setting any variables you have to reload the RPC with this method

DiscordRPC.refresh()

Clear

Disables the Activity.

DiscordRPC.clear(reset_values)

Taken variable: bool reset_values Standard value: false
When turning reset_values to true it completely clears the whole activity with its app_id and other values.

Unclear

Reenables the before cleared Activity. Only works with DiscordRPC.clear(reset_values = false)(default).

DiscordRPC.unclear()