Skip to content

Commit

Permalink
Fix RPC spamming warnings and errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Somfic committed Apr 17, 2024
1 parent aec7b68 commit 2661059
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions Discord/EliteAPI.Discord/EliteDangerousApiDiscordRichPresence.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class EliteDangerousApiDiscordRichPresence
{
private readonly ILogger<EliteDangerousApiDiscordRichPresence> _log;
private readonly IEliteDangerousApi _api;
private readonly DiscordRpcClient _client;
private DiscordRpcClient _client;

private string _currentSystem = "";
private string _currentBody = "";
Expand All @@ -25,13 +25,15 @@ public EliteDangerousApiDiscordRichPresence(ILogger<EliteDangerousApiDiscordRich
{
_log = log;
_api = api;
_client = new DiscordRpcClient("497862888128512041");
_client.Logger = new ExtensionLogger(_log);
}

public async Task StartAsync()
{
_log.LogDebug("Starting Discord Rich Presence...");

_client = new DiscordRpcClient("497862888128512041");
_client.Logger = new ExtensionLogger(_log);

_client.Initialize();

_api.Events.On<FileheaderEvent>(OnFileheader);
Expand Down Expand Up @@ -481,12 +483,12 @@ public void Info(string message, params object[] args)

public void Warning(string message, params object[] args)
{
_log.LogWarning(message, args);
_log.LogDebug(message, args);
}

public void Error(string message, params object[] args)
{
_log.LogError(message, args);
_log.LogDebug(message, args);
}

public DiscordRPC.Logging.LogLevel Level { get; set; }
Expand Down

0 comments on commit 2661059

Please sign in to comment.