Discord RPC Tutorial


How to use Discord Presence

The Discord Presence object allows your launcher to communicate with Discord Rich Presence.

This means your launcher can show live activity inside the user’s Discord profile, such as what page they are on, whether they are patching files, browsing downloads, or getting ready to play.

It can also return useful Discord user information back into the launcher, such as the connected username, display name, user ID, and avatar image URL.

Pro Tip

A simple way to think about it is this: the Discord Presence object connects your launcher to Discord, and the Discord actions control what gets shown and what data comes back.


What you can do with it

Once Discord Presence is set up, you can use it to:

show live launcher activity in Discord
change the presence as the user moves through your launcher
display the connected Discord username in your launcher UI
display the connected Discord avatar in your launcher UI
react when Discord connects, disconnects, or fails

This makes the launcher feel much more connected and alive.


What you need before you start

Before building anything in the launcher, you first need a Discord application.

Create one in the Discord Developer Portal:

Open Discord Developer Portal

Once you create your application, keep note of its Application ID. This is the main value your launcher needs in order to connect to Discord Rich Presence.

If you want presence images to appear in Discord, you should also upload image assets to your Discord application and keep note of their asset keys.

Official Discord developer documentation:

Discord Developer Documentation


How the Discord system works inside the launcher

Inside the launcher, the Discord Presence object acts as the Discord connection point.

You then use Discord actions to:

initialize the connection
update the presence text and images
clear the presence when needed

The launcher also exposes Discord-related events, so you can react when:

Discord connects
Discord disconnects
a presence update works
a presence update fails
an error occurs

On top of that, the launcher now automatically creates a set of built-in Discord variables when the runtime is active. These give you an easy way to use Discord identity data in your launcher without needing extra setup.


The built-in Discord variables

When Discord connects successfully, the launcher can populate these built-in variables:

%-%_discordConnected%-%
%-%_discordUserID%-%
%-%_discordUsername%-%
%-%_discordDisplayName%-%
%-%_discordDiscriminator%-%
%-%_discordAvatarHash%-%
%-%_discordAvatarURL%-%
%-%_discordApplicationID%-%

These are created automatically by the runtime.

That means you can use them directly in your launcher wherever variables are supported, including:

labels
conditions
image changes
object property updates
action parameters

Pro Tip

Even if Discord is not connected yet, these built-in variables still exist. They simply stay empty until the launcher receives real Discord data.


What each Discord variable means

%-%_discordConnected%-%

This tells you whether the launcher currently has an active Discord session.

Typical values:

1 = connected
0 = not connected

%-%_discordUserID%-%

The Discord user ID of the connected user.

%-%_discordUsername%-%

The username of the connected Discord user.

%-%_discordDisplayName%-%

The user’s display name when available. If Discord does not provide one, this usually falls back to the username.

%-%_discordDiscriminator%-%

The discriminator value if Discord provides one.

%-%_discordAvatarHash%-%

The raw avatar hash returned from Discord, when available.

%-%_discordAvatarURL%-%

A full direct avatar image URL that can be used in your launcher immediately.

This is the variable most users will care about if they want to show the Discord user’s avatar inside the launcher.

%-%_discordApplicationID%-%

The Application ID currently being used by the Discord Presence object.


The Discord actions

Initialize Discord

This starts the Discord session for your launcher. Without this action, nothing else Discord-related will work.

This is usually the first Discord action you should run.

A common place for it is:

On Launcher Start
or
when the user reaches your main home page

Update Discord Presence

This updates what Discord shows as the user’s current activity.

The main fields are:

Details
State
Large Image Key
Large Image Text
Small Image Key
Small Image Text

This is the action you use to tell Discord what the user is doing.

Clear Discord Presence

This removes the active Discord presence and clears the session state.

A common use is when the user logs out or when the launcher closes.


The Discord events

On Connected

Fires when the Discord session connects successfully.

This is one of the most useful Discord events because it confirms that the launcher is ready to work with Discord.

Common uses:

show a connected icon
hide a loading indicator
update the presence for the first time
display the user’s Discord info in the launcher

On Disconnected

Fires when the Discord session disconnects or is cleared.

Common uses:

hide Discord-only UI
show a disconnected state
remove connected-user visuals

On Error

Fires when an error occurs during the Discord flow.

Common uses:

show an error label
switch to fallback behaviour
hide Discord-specific features until retry

On Presence Update Success

Fires when the most recent presence update worked correctly.

You can use this to confirm that the activity was updated.

On Presence Update Error

Fires when a presence update fails.

This is useful for warnings, logs, or fallback UI.


Your first simple Discord setup

If you are brand new to this feature, start with the most basic working setup.

Step 1: Add a Discord Presence object

Place a Discord Presence object into your launcher.

Make sure it is configured with the correct Discord Application ID from your Discord developer application.

Step 2: Initialize Discord

Add an action on launcher start:

Initialize Discord

This starts the Discord session.

Step 3: Wait for the connection

Use the Discord object’s On Connected event.

This confirms that the session is active.

Step 4: Update the presence

Inside On Connected, add an Update Discord Presence action.

For example:

Details: Browsing Launcher
State: On Home Page
Large Image Key: launcher_logo
Large Image Text: My Launcher
Small Image Key: home_icon
Small Image Text: Home

That gives you a clean starter setup.


Example 1: Show launcher status in Discord

This is the simplest useful example.

Your flow:

On Launcher Start
→ Initialize Discord

Then:

On Connected
→ Update Discord Presence

Use values like:

Details: Using My Launcher
State: Getting Ready to Play

This tells Discord exactly what the user is doing in your launcher.


Example 2: Change the presence when the user changes page

You are not limited to one fixed status. You can update Discord Presence as the user moves around the launcher.

For example:

On your Downloads page:

Details: Browsing Downloads
State: Looking at available files

On your Servers page:

Details: Choosing Server
State: Multiplayer browser

On your News page:

Details: Reading Patch Notes
State: Latest updates

This makes your Discord integration feel much more dynamic.


Example 3: Show the Discord username in the launcher

Because the launcher now stores Discord identity in built-in variables, you can display the user’s Discord name directly in your UI.

A simple example would be a label with text set from:

%-%_discordUsername%-%

Or, if you want the friendlier display name:

%-%_discordDisplayName%-%

This is perfect for:

account bars
profile panels
personalised welcome messages

For example:

Welcome back, %-%_discordDisplayName%-%


Example 4: Show the Discord avatar in the launcher

This is one of the nicest upgrades now available.

Because the launcher now stores a full direct avatar URL in:

%-%_discordAvatarURL%-%

you can use that to show the connected Discord avatar in an Image object.

A practical setup would be:

On Connected
→ Change Image

Then set the new image source to:

%-%_discordAvatarURL%-%

Or, if you prefer:

use Set Object Property from Variable
Source Variable: _discordAvatarURL
Target Object: your Image object
Target Property: src

This allows the user’s Discord avatar to appear directly inside your launcher UI.

Pro Tip

If the user does not have an avatar available, the avatar URL variable may stay empty, so it is a good idea to use a default placeholder image when needed.


Example 5: Only show Discord profile UI when connected

You can use the built-in connection variable to control parts of your launcher.

For example:

Compare a Variable
Variable Name: _discordConnected
Condition: Equals
Value To Compare: 1

Then:

Show profile panel
Show avatar image
Show username label

This is a very clean way to hide Discord-related UI until the launcher is actually connected.


Example 6: Fall back when Discord is not connected

Not every user will have Discord available, and not every session will connect. So it is always a good idea to design a simple fallback.

For example:

If %-%_discordConnected%-% equals 0
show a default avatar
show generic user text
hide Discord-only buttons

This keeps your launcher clean even when Discord is unavailable.


Example 7: Store values in your own variables too

The built-in Discord variables are often enough on their own, but the existing action output fields still work as well.

That means on Initialize Discord you can still store values into your own custom variable names if you prefer.

For example:

Store Username in Variable → myDiscordName
Store User ID in Variable → myDiscordID
Store Avatar URL in Variable → myDiscordAvatar

This is useful if you want to keep your launcher logic built around your own variable naming.


Example 8: Update presence during patching

Discord Presence works very well with patching or update flows.

For example:

When patching starts:

Details: Updating Game Files
State: Preparing patch

During the patch:

Details: Updating Game Files
State: Downloading latest build

When finished:

Details: Ready to Play
State: Launcher is up to date

This makes your launcher activity feel much more polished inside Discord.


Example 9: Use Discord connection events to control UI

The Discord object can also drive UI changes.

For example:

On Connected
→ Show connected badge
→ Hide warning label
→ Show avatar image

On Disconnected
→ Hide connected badge
→ Show disconnected label
→ Reset profile image to default

On Error
→ Show warning text
→ Hide Discord-only controls

This makes the Discord integration useful even beyond the presence text itself.


Recommended beginner flow

If you want a safe and reliable structure, this is a very good one:

On Launcher Start
Initialize Discord

On Connected
Update Discord Presence
Show Discord-connected UI
Update profile label and image

On page changes or major launcher actions
Update Discord Presence again with more specific details

On Disconnected or On Error
Hide Discord profile UI
Show fallback UI

On Logout or Exit
Clear Discord Presence

That is a very strong starter setup for most launchers.


Good examples for Details and State

If you are unsure what to write in Discord Presence, here are some clean examples.

Details: Using My Launcher
State: On Home Page

Details: Reading News
State: Latest patch information

Details: Browsing Downloads
State: Looking at files

Details: Choosing Server
State: Multiplayer browser

Details: Updating Files
State: Downloading latest build

Details: Ready to Play
State: Launcher idle


Using images in Discord Presence

The large and small image fields in the update action rely on image asset keys from your Discord developer application.

That means:

you upload the assets in your Discord application
Discord stores them under image keys
you use those keys in your launcher’s Update Discord Presence action

For example:

Large Image Key: launcher_logo
Large Image Text: My Launcher
Small Image Key: patching_icon
Small Image Text: Updating

If you want official Discord documentation for developer setup, use:

Discord Developer Documentation


Common mistakes to avoid

Do not try to update the presence before Discord has been initialized.

Do not assume Discord is connected without checking the events or the built-in connection variable.

Do not forget to upload Rich Presence image assets if you want large or small images to appear in Discord.

Do not build your whole launcher so that it only works when Discord is available. It is much better to treat Discord as an enhancement rather than a requirement.

Do not forget that the avatar variable may be empty if Discord does not provide avatar data.


A simple full example

Here is a simple but strong beginner setup:

1. Add a Discord Presence object.
2. Enter your Discord Application ID.
3. On Launcher Start, run Initialize Discord.
4. On the Discord object’s On Connected event, run Update Discord Presence with your default launcher status.
5. Also on On Connected, set a profile label to %-%_discordDisplayName%-%.
6. Also on On Connected, change your profile image using %-%_discordAvatarURL%-%.
7. On On Disconnected, swap back to a default name and avatar.
8. On logout or exit, run Clear Discord Presence.

That gives you:

a live Discord status
a visible Discord username in the launcher
a visible Discord avatar in the launcher
clean fallback behaviour when Discord is unavailable


Final thoughts

The Discord Presence object is much more than just a status updater. It can now help make your launcher feel personal, connected, and reactive by bringing Discord identity and live activity directly into your launcher UI.

If you are just starting out, begin with the basics:

initialize Discord
update the presence on connect
show the username
show the avatar
clear the presence when done

Once that works, you can start changing the presence dynamically based on pages, downloads, patching, server browsing, and everything else your launcher does.

Pro Tip

A very good next step after this is a dedicated guide on using the built-in Discord variables in labels, image objects, conditions, and object property changes.