From 0ecd81f499ad2dd386f58d1d5a339427661a709c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 24 Feb 2026 20:42:57 +0000 Subject: [PATCH 1/2] Initial plan From 1925d22d1c1edbd06e39d11ed0f8114baa0e071e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 24 Feb 2026 20:47:03 +0000 Subject: [PATCH 2/2] Handle InvalidSession error from revolt.js client with reconnection logic Co-authored-by: ilBiondojs <86325934+ilBiondojs@users.noreply.github.com> --- index.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/index.js b/index.js index f78ed57..562b653 100644 --- a/index.js +++ b/index.js @@ -171,6 +171,27 @@ class Remix { this.memberMap.set(member.id.server, data); }); + var sessionReconnects = 0; + this.client.on("ready", () => { sessionReconnects = 0; }); + this.client.on("error", (err) => { + console.log("Client error:", err); + if (err?.data?.type === "InvalidSession") { + if (sessionReconnects >= 3) { + console.log("Too many InvalidSession errors. Giving up."); + return; + } + sessionReconnects++; + console.log("InvalidSession error. Attempting to reconnect (" + sessionReconnects + "/3)..."); + setTimeout(() => { + if (config.token) { + this.client.loginBot(config.token); + } else { + this.client.login(config.login); + } + }, 5000); + } + }); + console.log("Loading command files..."); this.handler = new CommandHandler(this.client, config.prefix); this.handler.setReplyHandler((t, msg) => {