-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from AceKiron/master
Added demo project to the source code and added a 5 second timer to see if Discord is even running
- Loading branch information
Showing
27 changed files
with
815 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#define np_get_avatar_url | ||
|
||
if (!is_string(argument0) || !is_string(argument1) || !string_length(argument0) || !string_length(argument1)) return ""; | ||
return "https://cdn.discordapp.com/avatars/" + argument0 + "/" + argument1 + ".png"; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/// @description Check if Discord's running | ||
|
||
ready = true; | ||
global.discord_initialized = false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/// @description Initialize Discord. | ||
|
||
#macro DISCORD_APP_ID "715161153319206912" | ||
|
||
ready = false; | ||
|
||
alarm[0] = room_speed * 5; | ||
|
||
if (!np_initdiscord(DISCORD_APP_ID, true, np_steam_app_id_empty)) | ||
{ | ||
show_error("NekoPresence init fail.", true); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/// @description quit | ||
|
||
game_end(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/// @description check if we can use the avatar. | ||
|
||
if (async_load[? "status"] >= 0) { | ||
sprite_index = async_load[? "id"]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/// @description Capture async events from NekoPresence. | ||
|
||
var ev_type = async_load[? "event_type"]; | ||
|
||
if (ev_type == "DiscordReady") | ||
{ | ||
global.discord_initialized = true; | ||
|
||
window_set_caption("We're ready!"); | ||
ready = true; | ||
show_debug_message("date: " + string(date_current_datetime())); | ||
np_setpresence_timestamps(date_current_datetime(), 0, false); | ||
np_setpresence_more("Small image text", "Large image text", false); | ||
|
||
//np_setpresence() should ALWAYS come the last!! | ||
np_setpresence("this is a state", "this is some details", "astraicon", ""); | ||
|
||
// passing a URL will add this sprite asynchronously via *internets* | ||
sprite_add(np_get_avatar_url(async_load[? "user_id"], async_load[? "avatar"]), 1, false, false, 0, 0); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/// @description Update NekoPresence so async events will execute. | ||
|
||
np_update(); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.