Browse Source

Fix log spam by disabling Discord when callbacks fail

tags/v1.2.0
NGnius (Graham) 4 years ago
parent
commit
83229c70d9
1 changed files with 12 additions and 1 deletions
  1. +12
    -1
      GameSDKcraft/Plugin.cs

+ 12
- 1
GameSDKcraft/Plugin.cs View File

@@ -246,7 +246,18 @@ namespace GamecraftRPC

public void OnUpdate() // called once per rendered frame (frame update)
{
if (DiscordRPC != null ) DiscordRPC.RunCallbacks();
if (DiscordRPC != null)
{
try
{
DiscordRPC.RunCallbacks();
}
catch (ResultException e)
{
GamecraftModdingAPI.Utility.Logging.LogWarning($"Discord integration has been disabled due to the exception " + e);
DiscordRPC = null;
}
}
}

public static void SetDiscordActivity(string state = null, string details = null, long start = 0, long end = 0, string largeImg = "gamecraft-logo-g", string largeTxt = "Gamecraft", string smallImg = "exmods-logo-xm2", string smallTxt = null, string partyId = null, int partyCurrentSize = 0, int partyMaxSize = 0, string matchSecret = null, string joinSecret = null, string spectateSecret = null, bool instance = true, string debug = "")


Loading…
Cancel
Save