Update the presence after enabling the RPC in Preferences

This commit is contained in:
sector-a
2026-04-06 04:18:10 -06:00
committed by Hundrec
parent afeb263ae1
commit e17a0d047a
2 changed files with 13 additions and 1 deletions
+6 -1
View File
@@ -431,7 +431,7 @@ class Preferences
static function get_enabledDiscordRPC():Bool
{
return Save?.instance?.options?.enabledDiscordRPC ?? false;
return Save?.instance?.options?.enabledDiscordRPC ?? true;
}
static function set_enabledDiscordRPC(value:Bool):Bool
@@ -454,6 +454,11 @@ class Preferences
if (enable)
{
DiscordClient.instance.init();
if (DiscordClient.presenceParamsCache != null)
{
DiscordClient.instance.setPresence(DiscordClient.presenceParamsCache);
}
}
else
{
@@ -33,6 +33,11 @@ class DiscordClient
var handlers:DiscordEventHandlers;
/**
* Latest passed parameters for the presence.
*/
public static var presenceParamsCache:Null<DiscordClientPresenceParams>;
private function new()
{
trace(' DISCORD '.bold().bg_blue() + ' Initializing event handlers...');
@@ -99,6 +104,8 @@ class DiscordClient
public function setPresence(params:DiscordClientPresenceParams):Void
{
presenceParamsCache = params;
var presence:DiscordRichPresence = new DiscordRichPresence();
// Presence should always be playing the game.