Update the presence after enabling the RPC in Preferences
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user