improved usermanagement debugging

This commit is contained in:
2023-05-02 13:30:32 +02:00
parent 16e496af55
commit ec939a268d
4 changed files with 22 additions and 18 deletions

View File

@@ -1,19 +1,20 @@
extends Node extends Node
func _ready(): func _ready():
#Discord_SDK.debug()
Discord_SDK.app_id = 1099618430065324082 Discord_SDK.app_id = 1099618430065324082
Discord_SDK.details = "A demo activity by vaporvee#1231" Discord_SDK.debug()
Discord_SDK.state = "Checkpoint 23/23" # Discord_SDK.app_id = 1099618430065324082
# Discord_SDK.details = "A demo activity by vaporvee#1231"
Discord_SDK.large_image = "game" # Discord_SDK.state = "Checkpoint 23/23"
Discord_SDK.large_image_text = "Try it now!" #
Discord_SDK.small_image = "boss" # Discord_SDK.large_image = "game"
Discord_SDK.small_image_text = "Fighting the end boss! D:" # Discord_SDK.large_image_text = "Try it now!"
# Discord_SDK.small_image = "boss"
#Discord_SDK.start_timestamp = int(Time.get_unix_time_from_system()) # Discord_SDK.small_image_text = "Fighting the end boss! D:"
Discord_SDK.end_timestamp = int(Time.get_unix_time_from_system()) + 3600 # +1 hour in unix time #
# #Discord_SDK.start_timestamp = int(Time.get_unix_time_from_system())
Discord_SDK.refresh() # Discord_SDK.end_timestamp = int(Time.get_unix_time_from_system()) + 3600 # +1 hour in unix time
#
$Info.text = $Info.text.replace("{discordinfo}",str(Discord_SDK.get_is_discord_working())).replace("{id}",str(Discord_SDK.app_id)).replace("{details}",Discord_SDK.details).replace("{state}",Discord_SDK.state).replace("{lkey}",Discord_SDK.large_image).replace("{ltext}",Discord_SDK.large_image_text).replace("{skey}",Discord_SDK.small_image).replace("{stext}",Discord_SDK.small_image_text).replace("{stimestamp}",str(Discord_SDK.start_timestamp)).replace("{etimestamp}",str(Discord_SDK.end_timestamp)) # Discord_SDK.refresh()
#
# $Info.text = $Info.text.replace("{discordinfo}",str(Discord_SDK.get_is_discord_working())).replace("{id}",str(Discord_SDK.app_id)).replace("{details}",Discord_SDK.details).replace("{state}",Discord_SDK.state).replace("{lkey}",Discord_SDK.large_image).replace("{ltext}",Discord_SDK.large_image_text).replace("{skey}",Discord_SDK.small_image).replace("{stext}",Discord_SDK.small_image_text).replace("{stimestamp}",str(Discord_SDK.start_timestamp)).replace("{etimestamp}",str(Discord_SDK.end_timestamp))

View File

@@ -78,11 +78,8 @@ void Discord_SDK::coreupdate()
if (result == discord::Result::Ok && app_id > 0) if (result == discord::Result::Ok && app_id > 0)
{ {
::core->RunCallbacks(); ::core->RunCallbacks();
core->UserManager().OnCurrentUserUpdate.Connect([]()
{ core->UserManager().GetCurrentUser(&user); });
} }
} }
void Discord_SDK::debug() void Discord_SDK::debug()
{ {
result = discord::Core::Create(1080224638845591692, DiscordCreateFlags_NoRequireDiscord, &core); result = discord::Core::Create(1080224638845591692, DiscordCreateFlags_NoRequireDiscord, &core);
@@ -96,6 +93,8 @@ void Discord_SDK::debug()
if (result == discord::Result::Ok) if (result == discord::Result::Ok)
{ {
core->ActivityManager().UpdateActivity(activity, [](discord::Result result) {}); core->ActivityManager().UpdateActivity(activity, [](discord::Result result) {});
core->UserManager().OnCurrentUserUpdate.Connect([]()
{ core->UserManager().GetCurrentUser(&user); });
} }
else else
UtilityFunctions::push_warning("Discord Activity couldn't be updated. It could be that Discord isn't running!"); UtilityFunctions::push_warning("Discord Activity couldn't be updated. It could be that Discord isn't running!");
@@ -133,7 +132,11 @@ String Discord_SDK::get_details() const
void Discord_SDK::refresh() void Discord_SDK::refresh()
{ {
if (result == discord::Result::Ok && app_id > 0) if (result == discord::Result::Ok && app_id > 0)
{
core->ActivityManager().UpdateActivity(activity, [](discord::Result result) {}); core->ActivityManager().UpdateActivity(activity, [](discord::Result result) {});
core->UserManager().OnCurrentUserUpdate.Connect([]()
{ core->UserManager().GetCurrentUser(&user); });
}
else else
UtilityFunctions::push_warning("Discord Activity couldn't be updated. It could be that Discord isn't running!"); UtilityFunctions::push_warning("Discord Activity couldn't be updated. It could be that Discord isn't running!");
} }