Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions discord/UserObject.sp
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,11 @@ public int Native_DiscordUser_IsVerified(Handle plugin, int numParams) {
public int Native_DiscordUser_IsBot(Handle plugin, int numParams) {
Handle hJson = GetNativeCell(1);
return JsonObjectGetBool(hJson, "bot");
}

public int Native_DiscordUser_GetDisplayName(Handle plugin, int numParams) {
Handle hJson = GetNativeCell(1);
char buffer[64];
JsonObjectGetString(hJson, "global_name", buffer, sizeof(buffer));
SetNativeString(2, buffer, GetNativeCell(3));
}
4 changes: 3 additions & 1 deletion discord_api.sp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma semicolon 1
#pragma dynamic 25000

#define PLUGIN_VERSION "0.1.103"
#define PLUGIN_VERSION "0.1.107"

#include <sourcemod>
#include <discord>
Expand Down Expand Up @@ -79,6 +80,7 @@ public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max
CreateNative("DiscordUser.IsVerified", Native_DiscordUser_IsVerified);
CreateNative("DiscordUser.GetEmail", Native_DiscordUser_GetEmail);
CreateNative("DiscordUser.IsBot", Native_DiscordUser_IsBot);
CreateNative("DiscordUser.GetDisplayName", Native_DiscordUser_GetDisplayName);

//MessageObject.sp
CreateNative("DiscordMessage.GetID", Native_DiscordMessage_GetID);
Expand Down
3 changes: 3 additions & 0 deletions include/discord.inc
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ methodmap DiscordUser < Handle {
public native void GetID(char[] buffer, int maxlength);

public native void GetUsername(char[] buffer, int maxlength);

public native void GetDisplayName(char[] buffer, int maxlength);

public native void GetDiscriminator(char[] buffer, int maxlength);
public int GetDiscriminatorInt() {
Expand Down Expand Up @@ -161,6 +163,7 @@ public void __pl_discordapi_SetNTVOptional()
MarkNativeAsOptional("DiscordUser.IsVerified");
MarkNativeAsOptional("DiscordUser.GetEmail");
MarkNativeAsOptional("DiscordUser.IsBot");
MarkNativeAsOptional("DiscordUser.GetDisplayName");
MarkNativeAsOptional("DiscordMessage.GetID");
MarkNativeAsOptional("DiscordMessage.IsPinned");
MarkNativeAsOptional("DiscordMessage.DiscordUser GetAuthor");
Expand Down