-
Notifications
You must be signed in to change notification settings - Fork 1
Users
YYBartT edited this page Mar 23, 2023
·
8 revisions
Fetch information about the currently connected user account.
Discord_Users_GetCurrentUser()
struct = Discord_User_GetCurrentUser();
username = struct.username;
bot = struct.bot;
userId = struct.userId;
discriminator = struct.discriminator;
Get the PremiumType for the currently connected user.
Discord_Users_GetCurrentUserPremiumType()
switch(Discord_User_GetCurrentUserPremiumType())
{
case Discord_PremiumType_None:
show_debug_message("User is not a Nitro subscriber");
break;
case Discord_PremiumType_Tier1:
show_debug_message("User has Nitro Classic");
break;
case Discord_PremiumType_Tier2:
show_debug_message("User has Nitro");
break;
}
Get user information for a given id.
This is an asynchronous function that will trigger the Async Social Event when the task is finished, after which you can use the following functions.
Discord_Users_GetUser(userId)
Argument | Type | Description |
---|---|---|
userId | int64 | Identifier of the user |
N/A
Discord_Users_GetUser(userId);
The code sample above save the identifier that can be used inside an Async Social Event.
if (async_load[? "type"] == "Discord_User_GetUser")
{
if (async_load[? "result"] == Discord_OK)
{
show_debug_message(async_load[? "type"] + " succeeded!");
show_debug_message(async_load[? "user"]);
}
else
{
show_debug_message(async_load[? "type"] + " failed!");
}
}
The code above matches the response against the correct event type and logs the success of the task.
Set the current user's username information.
Discord_Users_SetCurrentUsername(name)
Argument | Type | Description |
---|---|---|
username | string | The new username to be applied to the current user. |
Discord_User_SetCurrentUsername("SuperUser");
The code sample above will update the current user's username.
YoYoGames 2024