Skip to content

Commit

Permalink
Fix: workerが起動し終わる前にjoinすると壊れるのを修正 (#479)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mogyuchi authored Apr 30, 2023
1 parent 2cc1e88 commit 4af5610
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/commands/join.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Command, type ChatInputCommand } from '@sapphire/framework'
import { guildCtxManager } from '../index.js'
import { guildCtxManager, workerClientMap } from '../index.js'
import { Client, StageChannel } from 'discord.js'

export class JoinCommand extends Command {
Expand Down Expand Up @@ -55,6 +55,20 @@ export class JoinCommand extends Command {
})
}

if (workerClientMap.size === process.env.WORKER_TOKENS.split(',').length) {
return interaction.reply({
embeds: [
{
color: 0xff0000,
title: 'エラー',
description:
'worker の準備が整っていません。十数秒後に再試行してください。',
},
],
ephemeral: true,
})
}

const guildCtx = guildCtxManager.get(interaction.member.guild)

if (guildCtx.connectionManager.channelMap.has(voiceChannel)) {
Expand Down

0 comments on commit 4af5610

Please sign in to comment.