-
Notifications
You must be signed in to change notification settings - Fork 1
Users
Discord_Users_GetCurrentUser
Discord_Users_GetCurrentUserPremiumType
Discord_Users_GetUser
Discord_Users_SetCurrentUsername
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.
This extension has functions that return a data structure containing information about a Discord user.
Discord_User_GetCurrentUser
Discord_User_GetUser
Discord_Relationship_GetAt
Discord_Relationship_Get
Field | Type | Description |
---|---|---|
userId | int64 | The unique ID assigned to the user by Discord. |
username | string | The username of the user, which is the name displayed on their profile and in chat messages. |
discriminator | string | The four-digit number that appears after the username, used to distinguish between users with the same username. |
avatar | string | The hash of the user's avatar image. |
bot | bool | A boolean value indicating whether the user is a bot account or a human user. |
The Presence struct contains information about a user's current online status and activity.
Field | Type | Description |
---|---|---|
Status | The user's current online status. | |
Activity | Activity | The user's current activity, if any. |
Key | Datatype | Description |
---|---|---|
result | real | Result code of the async request |
type | string | "Discord_User_GetUser" |
user | User | The user data |
The PremiumType enum describes the type of Nitro subscription a user has. It has the following values and descriptions:
Constant | Value | Description |
---|---|---|
Discord_PremiumType_None | 0 | Not a Nitro subscriber |
Discord_PremiumType_Tier1 | 1 | Nitro Classic subscriber |
Discord_PremiumType_Tier2 | 2 | Nitro subscriber |
Discord_PremiumType_Tier3 | 3 | Nitro Basic subscriber (formerly Nitro) |
YoYoGames 2024