From 661b3c17b9bf2b29ba8f486981b7e764229e2f8f Mon Sep 17 00:00:00 2001 From: Josh Dassinger Date: Tue, 12 Jul 2022 20:18:40 -0500 Subject: [PATCH] Update Socket to fix spamming issue --- Oxide.Ext.Discord/WebSockets/Socket.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Oxide.Ext.Discord/WebSockets/Socket.cs b/Oxide.Ext.Discord/WebSockets/Socket.cs index 25f8f6fdc..d7ca1b1b6 100644 --- a/Oxide.Ext.Discord/WebSockets/Socket.cs +++ b/Oxide.Ext.Discord/WebSockets/Socket.cs @@ -263,8 +263,10 @@ public void Reconnect() SocketState = SocketState.PendingReconnect; } + _reconnectRetries++; + //If we haven't had any errors reconnect to the gateway - if (_reconnectRetries == 0) + if (_reconnectRetries == 1) { Interface.Oxide.NextTick(Connect); return; @@ -283,7 +285,6 @@ public void Reconnect() _logger.Warning($"Attempting to reconnect to Discord... [Retry={_reconnectRetries.ToString()}]"); _reconnectTimer.Start(); - _reconnectRetries++; } private void ReconnectWebsocket(object sender, ElapsedEventArgs e) @@ -305,4 +306,4 @@ internal void ResetRetries() _reconnectRetries = 0; } } -} \ No newline at end of file +}