GetPlayerDiscordId
The player’s Discord user id - checked, not their game’s word.
A string of 17-20 digits (keep it a string: it is too long for a Lua number). The player signed in with Discord in their KCD:MP launcher,
Discord itself said whose account it is, and their game proved it to this server - so it is theirs, and a copy of it from someone else’s
join does not count. nil when the mode does not ask for it (UseDiscordIdentity), the player has not signed in with Discord, or their
account did not hold (the server log says why).
With a bot of your own, the id is the key for a role check: GetDiscordMemberRoles.
Syntax
Section titled “Syntax”GetPlayerDiscordId(pid)| Parameter | Type | |
|---|---|---|
pid |
number | the player |
Returns
Section titled “Returns”string - the Discord user id; nil when none
Example
Section titled “Example”function OnPlayerConnect(pid) local discord = GetPlayerDiscordId(pid) if discord then Log(GetPlayerName(pid) .. " is " .. GetPlayerDiscordName(pid) .. " on Discord (" .. discord .. ")") endendSee also
Section titled “See also”GetPlayerDiscordName · UseDiscordIdentity · GetDiscordMemberRoles · GetPlayerUid · the Joins and Discord group of the index
