Fix log spam by disabling Discord when callbacks fail
This commit is contained in:
parent
c292f4e4a8
commit
83229c70d9
1 changed files with 12 additions and 1 deletions
|
@ -246,7 +246,18 @@ namespace GamecraftRPC
|
||||||
|
|
||||||
public void OnUpdate() // called once per rendered frame (frame update)
|
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 = "")
|
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…
Add table
Reference in a new issue