From c78a6790b13bb2bcff4f76cde47f83a09f9185ea Mon Sep 17 00:00:00 2001 From: Christopher Felegy Date: Sun, 19 May 2019 12:16:37 -0400 Subject: [PATCH] fix: don't raise REST log events twice The DiscordSocketClient and DiscordSocketRestClient share the same backing API client, so the Log events on both clients will be raised from the same API calls. Proxying log events from the DiscordSocketRestClient then means that the Log event the user hooks into will be raised twice for a single log message. Thanks to @TheCasino for noticing this. --- src/Discord.Net.WebSocket/DiscordSocketClient.cs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/Discord.Net.WebSocket/DiscordSocketClient.cs b/src/Discord.Net.WebSocket/DiscordSocketClient.cs index 4deb2f40b..60d5c73c9 100644 --- a/src/Discord.Net.WebSocket/DiscordSocketClient.cs +++ b/src/Discord.Net.WebSocket/DiscordSocketClient.cs @@ -132,10 +132,6 @@ namespace Discord.WebSocket ExclusiveBulkDelete = config.ExclusiveBulkDelete; State = new ClientState(0, 0); Rest = new DiscordSocketRestClient(config, ApiClient); - Rest.Log += (log) => - { - return _restLogger.LogAsync(log.Severity, log.Message, log.Exception); - }; _heartbeatTimes = new ConcurrentQueue(); _stateLock = new SemaphoreSlim(1, 1);