GetPlayerDiscordPresence

From Wiki G1R-MP G1 Remake Multiplayer
Revision as of 09:35, 20 October 2026 by QCherry (talk | contribs) (Document upcoming 0.1.9 Discord Rich Presence: server Lua functions, callback, opt-in and owner setup; not a release)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

getPlayerDiscordPresence

Available from 0.1.9 (upcoming; not yet publicly released). Not included in public 0.1.8. Use matching updated clients and server.

Server-side only. Part of Discord Rich Presence. See Discord Presence configuration for the optional server-owner resource.

Syntax

local profile = getPlayerDiscordPresence(playerId)

Parameters and behavior

Numeric game player ID. Reads a copy of the currently requested server profile (not Discord's public display), including read-only applicationId and owner strings. Can inspect the owner of another resource's profile. Modifying the returned table does not change server state.

Returns

Fields table plus metadata, or nil if there is no active profile / the player is invalid or offline. Do not pass owner or applicationId back to set/update: they are not writable profile fields.

Examples, lifecycle and safety

See Discord Rich Presence for complete initialization, location/job updates, field removal, timestamps, counts, buttons and callback examples. Player launcher opt-in is off by default and cannot be overridden. No bot or token is needed; no Discord account identity is returned. Do not forward arbitrary client input to this server API.