Skip to content
This repository has been archived by the owner on Jan 15, 2024. It is now read-only.

Commit

Permalink
fix #77 クライアントの作成処理が止まる問題を修正
Browse files Browse the repository at this point in the history
  • Loading branch information
yogarasu committed Sep 21, 2022
1 parent c84658b commit 29e3369
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions libs/client.mts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -25,8 +26,12 @@ export const createDiscordClient = async (
})

await client.login(discordBotToken)
// FIXME: Processing may not proceed from client create
// await new Promise<void>((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) {
Expand Down

0 comments on commit 29e3369

Please sign in to comment.