diff --git a/BTTDRichDiscordPresence/Constants.cs b/BTTDRichDiscordPresence/Constants.cs index af8d981..07809bb 100644 --- a/BTTDRichDiscordPresence/Constants.cs +++ b/BTTDRichDiscordPresence/Constants.cs @@ -21,9 +21,9 @@ internal static class Constants internal static int MaxRetries { get; } = 5; /// - /// Delay between retries in milliseconds. + /// Delay between retries in seconds. /// - internal static int RetryDelay { get; } = 5000; + internal static int RetryDelay { get; } = 5; /// /// Mapping of map ids to map names. diff --git a/BTTDRichDiscordPresence/DiscordRichPresence.cs b/BTTDRichDiscordPresence/DiscordRichPresence.cs index 26ffaad..b04155d 100644 --- a/BTTDRichDiscordPresence/DiscordRichPresence.cs +++ b/BTTDRichDiscordPresence/DiscordRichPresence.cs @@ -61,7 +61,16 @@ public void SetPresence( }, }; - activityManager.UpdateActivity(presence, resultCallback); + activityManager.UpdateActivity(presence, result => + { + if (result == Result.NotRunning) + { + this.client?.Dispose(); + this.client = null; + this.retries = 0; + } + resultCallback?.Invoke(result); + }); } ///