GetDiscordRichPresenceUserID
Jump to navigation
Jump to search
Important Note: The function will correctly display the UserID when the user has given consent and successfully connected to the Rich Presence application. |
Syntax
string getDiscordRichPresenceUserID()
Returns
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.
Example
This example displays the user's userid in the chat when 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 data! Grant permission in the settings!") else outputChatBox("Yours userid: "..id) end end end )