getDiscordRichPresenceUserID
Client-side
Server-side
Shared
Manual Review Required
Please finish this page using the corresponding Old Wiki article. Go to Contribution guidelines for more information.
The function returns the client Discord UserID.
Important
The function will correctly return the UserID if the user has given consent beforehand and is connected to the Rich Presence application.
Syntax
string getDiscordRichPresenceUserID ( )Returns
- string: value
It will return an empty string ("") if the user has not given consent or has disabled the Rich Presence synchronization option. Otherwise, it will return the userid as a string.
Code Examples
shared
This example displays the user's userid in the chat if they have granted permission to share data. Otherwise, they will receive an appropriate message.
addCommandHandler("getmyuserid", function () if isDiscordRichPresenceConnected() then local id = getDiscordRichPresenceUserID() if id == "" then outputChatBox("You didn't allow consent to share Discord data! Grant permission in the settings!") else outputChatBox("Your Discord userid: "..id) end end end)See Also
Discord Functions
- getDiscordRichPresenceUserID
- isDiscordRichPresenceConnected
- resetDiscordRichPresenceData
- setDiscordApplicationID
- setDiscordRichPresenceAsset
- setDiscordRichPresenceButton
- setDiscordRichPresenceDetails
- setDiscordRichPresenceEndTime
- setDiscordRichPresencePartySize
- setDiscordRichPresenceSmallAsset
- setDiscordRichPresenceStartTime
- setDiscordRichPresenceState