Discord
Discord is a utility class that allows Lua scripts to create, configure, and update Discord Rich Presence. It provides modular functions for setting activity metadata, assets, party info, secrets, and interactive buttons using Unreal Engineโs Discord SDK.

Constructorโ
Example
local activity = Discord.Initialize {
appId = "123456789012345678",
details = "Exploring the map",
state = "Downtown"
}
Discord.SetAssets(activity, {
largeImage = "city",
largeText = "Downtown City",
smallImage = "hat",
smallText = "Wearing Fedora"
})
Discord.SetParty(activity, {
id = "group-abc",
size = 2,
max = 4
})
Discord.SetSecrets(activity, {
join = "join_code_xyz"
})
Discord.SetButtons(activity, {
{ label = "Join Me", url = "https://example.com/join" }
})
Discord.Update(activity)
Functionsโ
Initializeโ
Creates a new Discord activity and applies basic metadata
- config:
table - appId:
string(optional) - details:
string(optional) - state:
string(optional) - returns: UDiscordActivity
Example
local activity = Discord.Initialize {
appId = "123456789012345678",
details = "Main Menu",
state = "Idle"
}
SetAssetsโ
Sets Discord image keys and hover tooltips
- activity:
UDiscordActivity - assets:
table - largeImage:
string(optional) - largeText:
string(optional) - smallImage:
string(optional) - smallText:
string(optional)
Example
Discord.SetAssets(activity, {
largeImage = "world",
largeText = "Earth View",
smallImage = "badge",
smallText = "Explorer"
})
SetPartyโ
Adds party information to the activity
- activity:
UDiscordActivity - party:
table - id:
string(optional) - size:
number(optional) - max:
number(optional)
Example
Discord.SetParty(activity, {
id = "party-123",
size = 3,
max = 5
})
SetSecretsโ
Sets join secrets for enabling Discord join feature
- activity:
UDiscordActivity - secrets:
table - join:
string(optional)
Example
Discord.SetSecrets(activity, {
join = "secret-token-abc"
})
SetButtonsโ
Adds one or more clickable buttons to the activity
- activity:
UDiscordActivity - buttons:
table - label:
string - url:
string
Example
Discord.SetButtons(activity, {
{ label = "Join Game", url = "https://example.com/join" },
{ label = "Visit Site", url = "https://example.com" }
})
Updateโ
Pushes the constructed activity to Discord Rich Presence.
- activity:
UDiscordActivity - callback:
function(optional) โ Called with the result when the update completes
Example
Discord.Update(activity, function(success)
print("Update result:", success)
end)