From 29e3369c5f3186556ab886ecef55668f2e592124 Mon Sep 17 00:00:00 2001 From: yogarasu Date: Wed, 21 Sep 2022 20:51:43 +0900 Subject: [PATCH] =?UTF-8?q?fix=20#77=20=E3=82=AF=E3=83=A9=E3=82=A4?= =?UTF-8?q?=E3=82=A2=E3=83=B3=E3=83=88=E3=81=AE=E4=BD=9C=E6=88=90=E5=87=A6?= =?UTF-8?q?=E7=90=86=E3=81=8C=E6=AD=A2=E3=81=BE=E3=82=8B=E5=95=8F=E9=A1=8C?= =?UTF-8?q?=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- libs/client.mts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/libs/client.mts b/libs/client.mts index c196c8c..1c569f1 100644 --- a/libs/client.mts +++ b/libs/client.mts @@ -2,6 +2,7 @@ import { WebClient as SlackClient } from "@slack/web-api" import type { WebClient as SlackClientType } from "@slack/web-api" import { Client as DiscordClient, GatewayIntentBits } from "discord.js" import type { Guild as DiscordClientType } from "discord.js" +import { once } from "node:events" /** * Create slack client @@ -25,8 +26,12 @@ export const createDiscordClient = async ( }) await client.login(discordBotToken) - // FIXME: Processing may not proceed from client create - // await new Promise((resolve) => client.on("ready", () => resolve())) + + // client.on("debug", console.log) + client.on("error", (error) => { + throw new Error(`Client error: ${error}`) + }) + await once(client, "ready") const guild = client.guilds.cache.get(discordServerId) if (!guild) {