Discord
constDiscord:object
Defined in: client/api.d.ts:2569
Client-only Discord rich-presence composer exposed as the global Discord; setters stage values until update or setPresence publishes them.
Type Declaration
Section titled “Type Declaration”clear()
Section titled “clear()”clear():
boolean
Clears the published Discord activity and resets staged state.
Returns
Section titled “Returns”boolean
True when dispatched; false when Discord is unavailable.
getUserId()
Section titled “getUserId()”getUserId():
string
Returns the signed-in Discord user’s snowflake.
Returns
Section titled “Returns”string
User ID string, or an empty string until available.
isAvailable()
Section titled “isAvailable()”isAvailable():
boolean
Checks whether Discord is connected and can publish presence.
Returns
Section titled “Returns”boolean
True when rich presence is initialized.
reset()
Section titled “reset()”reset():
void
Resets staged activity fields without publishing a Discord update.
Returns
Section titled “Returns”void
setAssets()
Section titled “setAssets()”setAssets(
assets):void
Stages multiple Discord image fields at once.
Parameters
Section titled “Parameters”assets
Section titled “assets”Asset keys and tooltips to merge into the staged activity.
largeImage?
Section titled “largeImage?”string
largeText?
Section titled “largeText?”string
smallImage?
Section titled “smallImage?”string
smallText?
Section titled “smallText?”string
Returns
Section titled “Returns”void
setDetails()
Section titled “setDetails()”setDetails(
details):void
Stages the top presence line.
Parameters
Section titled “Parameters”details
Section titled “details”string
the top presence line.
Returns
Section titled “Returns”void
setEndTimestamp()
Section titled “setEndTimestamp()”setEndTimestamp(
seconds):void
Stages the countdown Unix timestamp in seconds; zero clears it.
Parameters
Section titled “Parameters”seconds
Section titled “seconds”number
the countdown Unix timestamp in seconds; zero clears it.
Returns
Section titled “Returns”void
setInstance()
Section titled “setInstance()”setInstance(
instance):void
Stages whether the activity represents an instanced session.
Parameters
Section titled “Parameters”instance
Section titled “instance”boolean
whether the activity represents an instanced session.
Returns
Section titled “Returns”void
setJoinSecret()
Section titled “setJoinSecret()”setJoinSecret(
secret):void
Stages the opaque join secret that enables invitations.
Parameters
Section titled “Parameters”secret
Section titled “secret”string
the opaque join secret that enables invitations.
Returns
Section titled “Returns”void
setLargeImage()
Section titled “setLargeImage()”setLargeImage(
assetKey):void
Stages the large image asset key.
Parameters
Section titled “Parameters”assetKey
Section titled “assetKey”string
the large image asset key.
Returns
Section titled “Returns”void
setLargeText()
Section titled “setLargeText()”setLargeText(
text):void
Stages the large image tooltip.
Parameters
Section titled “Parameters”string
the large image tooltip.
Returns
Section titled “Returns”void
setMatchSecret()
Section titled “setMatchSecret()”setMatchSecret(
secret):void
Stages the opaque match secret.
Parameters
Section titled “Parameters”secret
Section titled “secret”string
the opaque match secret.
Returns
Section titled “Returns”void
setName()
Section titled “setName()”setName(
name):void
Stages the activity name.
Parameters
Section titled “Parameters”string
the activity name.
Returns
Section titled “Returns”void
setParty()
Section titled “setParty()”setParty(
party):void
Stages multiple Discord party fields at once.
Parameters
Section titled “Parameters”Party fields to merge into the staged activity.
string
privacy?
Section titled “privacy?”"private" | "public" | number
[number, number]
Returns
Section titled “Returns”void
setPartyId()
Section titled “setPartyId()”setPartyId(
id):void
Stages the party grouping identifier.
Parameters
Section titled “Parameters”string
the party grouping identifier.
Returns
Section titled “Returns”void
setPartyPrivacy()
Section titled “setPartyPrivacy()”setPartyPrivacy(
privacy):void
Stages the party join-privacy name or numeric enum value.
Parameters
Section titled “Parameters”privacy
Section titled “privacy”number | "private" | "public"
the party join-privacy name or numeric enum value.
Returns
Section titled “Returns”void
setPartySize()
Section titled “setPartySize()”setPartySize(
current,max):void
Stages the party’s current and maximum size.
Parameters
Section titled “Parameters”current
Section titled “current”number
Current party member count.
number
Maximum party capacity.
Returns
Section titled “Returns”void
setPresence()
Section titled “setPresence()”setPresence(
options):boolean
Merges a complete option batch into the staged activity and publishes it immediately.
Parameters
Section titled “Parameters”options
Section titled “options”Record<string, unknown>
Batch of supported activity, timestamp, asset, party, secret, instance, and platform fields.
Returns
Section titled “Returns”boolean
True when the update was dispatched; false when Discord is unavailable.
setSecrets()
Section titled “setSecrets()”setSecrets(
secrets):void
Stages multiple Discord activity secrets at once.
Parameters
Section titled “Parameters”secrets
Section titled “secrets”Opaque secrets to merge into the staged activity.
string
match?
Section titled “match?”string
spectate?
Section titled “spectate?”string
Returns
Section titled “Returns”void
setSmallImage()
Section titled “setSmallImage()”setSmallImage(
assetKey):void
Stages the small image asset key.
Parameters
Section titled “Parameters”assetKey
Section titled “assetKey”string
the small image asset key.
Returns
Section titled “Returns”void
setSmallText()
Section titled “setSmallText()”setSmallText(
text):void
Stages the small image tooltip.
Parameters
Section titled “Parameters”string
the small image tooltip.
Returns
Section titled “Returns”void
setSpectateSecret()
Section titled “setSpectateSecret()”setSpectateSecret(
secret):void
Stages the opaque spectate secret.
Parameters
Section titled “Parameters”secret
Section titled “secret”string
the opaque spectate secret.
Returns
Section titled “Returns”void
setStartTimestamp()
Section titled “setStartTimestamp()”setStartTimestamp(
seconds):void
Stages the elapsed-time Unix timestamp in seconds; zero clears it.
Parameters
Section titled “Parameters”seconds
Section titled “seconds”number
the elapsed-time Unix timestamp in seconds; zero clears it.
Returns
Section titled “Returns”void
setState()
Section titled “setState()”setState(
state):void
Stages the bottom presence line.
Parameters
Section titled “Parameters”string
the bottom presence line.
Returns
Section titled “Returns”void
setSupportedPlatforms()
Section titled “setSupportedPlatforms()”setSupportedPlatforms(
flags):void
Stages the supported-platform bitmask: Desktop 1, Android 2, and iOS 4.
Parameters
Section titled “Parameters”number
the supported-platform bitmask: Desktop 1, Android 2, and iOS 4.
Returns
Section titled “Returns”void
setType()
Section titled “setType()”setType(
type):void
Stages the Discord activity verb or numeric enum value.
Parameters
Section titled “Parameters”number | "playing" | "streaming" | "listening" | "watching"
the Discord activity verb or numeric enum value.
Returns
Section titled “Returns”void
update()
Section titled “update()”update():
boolean
Publishes the currently staged activity as one rate-limited Discord update.
Returns
Section titled “Returns”boolean
True when dispatched; false when Discord is unavailable.
