diff --git a/index.mjs b/index.mjs index b18b51b..b881011 100644 --- a/index.mjs +++ b/index.mjs @@ -114,6 +114,7 @@ export class Remix { }; let presenceRotationIndex = presenceContents.length > 1 ? 1 : 0; let presenceRotationStarted = false; + let wsHandlerRearmStarted = false; const timers = config.timers ?? {}; this.T = { @@ -287,6 +288,14 @@ export class Remix { this._attachWsErrorHandlers(); + if (!wsHandlerRearmStarted) { + wsHandlerRearmStarted = true; + setInterval(() => { + this._attachWsErrorHandlers(); + this.gatewayHandler.attachRawListener(); + }, 5_000).unref?.(); + } + const botId = client.user?.id ?? "0"; await this.settingsMgr.setBotId(botId);