Skip to content

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.

GetPlayerDiscordId(pid)
Parameter Type
pid number the player

string - the Discord user id; nil when none

function OnPlayerConnect(pid)
local discord = GetPlayerDiscordId(pid)
if discord then
Log(GetPlayerName(pid) .. " is " .. GetPlayerDiscordName(pid) .. " on Discord (" .. discord .. ")")
end
end

GetPlayerDiscordName · UseDiscordIdentity · GetDiscordMemberRoles · GetPlayerUid · the Joins and Discord group of the index