From 66c5cab5d3f6cff9f6ad8b50370a9a8e0f647d83 Mon Sep 17 00:00:00 2001 From: Tabby <41929769+tabby-cat-nya@users.noreply.github.com> Date: Mon, 3 Nov 2025 01:38:28 +1100 Subject: [PATCH] recover on disconnection --- addons/discord_gd/discord.gd | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/addons/discord_gd/discord.gd b/addons/discord_gd/discord.gd index cafa572..cc90a22 100644 --- a/addons/discord_gd/discord.gd +++ b/addons/discord_gd/discord.gd @@ -11,7 +11,7 @@ For Copyright and License: See LICENSE.md #region Public Variables var TOKEN: String -var VERBOSE: bool = false +var VERBOSE: bool = true var INTENTS: int = 513 # Caches @@ -676,7 +676,11 @@ func _send_heartbeat() -> void: # Send heartbeat OP code 1 return var response_payload = {'op': 1, 'd': _last_seq} - _send_dict_wss(response_payload) + if _client.get_ready_state() == WebSocketPeer.State.STATE_OPEN: + _send_dict_wss(response_payload) + else: + print("Websocket not open, skipping send") + login() _heartbeat_ack_received = false if VERBOSE: print('Heartbeat sent!')