From 6658b582dbeba7e072a7a04c4efa255e7f634aef Mon Sep 17 00:00:00 2001 From: PalmDevs Date: Sun, 23 Jun 2024 17:01:28 +0700 Subject: [PATCH] fix(bots/discord): connect to discord API even if initial bot API connection fails --- bots/discord/src/events/api/disconnect.ts | 2 +- bots/discord/src/index.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bots/discord/src/events/api/disconnect.ts b/bots/discord/src/events/api/disconnect.ts index f6306e5..29d1ae4 100644 --- a/bots/discord/src/events/api/disconnect.ts +++ b/bots/discord/src/events/api/disconnect.ts @@ -26,5 +26,5 @@ on('disconnect', (reason, msg) => { logger.info( `Disconnected from bot API ${++api.disconnectCount} times (this time because: ${reason}, ${msg}), reconnecting again...`, ) - setTimeout(() => ws.connect(), 10000) + setTimeout(() => api.client.connect(), 10000) }) diff --git a/bots/discord/src/index.ts b/bots/discord/src/index.ts index a5a2026..f385732 100644 --- a/bots/discord/src/index.ts +++ b/bots/discord/src/index.ts @@ -14,10 +14,10 @@ for (const event of listAllFilesRecursive(pathJoinCurrentDir(import.meta.url, 'e await import(event) } -await api.client.connect() +api.client.connect() for (const event of listAllFilesRecursive(pathJoinCurrentDir(import.meta.url, 'events', 'discord'))) { await import(event) } -await discord.client.login() +discord.client.login()