From d2cedeceb13ded109f4a17f5725a89662ce5dd6b Mon Sep 17 00:00:00 2001 From: Helloyunho Date: Wed, 31 Mar 2021 02:01:19 +0900 Subject: [PATCH] :white_check_mark: Add voice kick test --- src/test/cmds/kickFromVoice.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/test/cmds/kickFromVoice.ts diff --git a/src/test/cmds/kickFromVoice.ts b/src/test/cmds/kickFromVoice.ts new file mode 100644 index 0000000..5730703 --- /dev/null +++ b/src/test/cmds/kickFromVoice.ts @@ -0,0 +1,20 @@ +import { Command } from '../../../mod.ts' +import { CommandContext } from '../../models/command.ts' + +export default class KickFromVoiceCommand extends Command { + name = 'kickFromVoice' + + async execute(ctx: CommandContext): Promise { + if (ctx.guild !== undefined) { + const voiceStates = await ctx.guild.voiceStates.array() + if (voiceStates !== undefined) { + voiceStates.forEach(async (voiceState) => { + const member = await voiceState.disconnect() + if (member !== undefined) { + ctx.channel.send(`Kicked member ${member.id}`) + } + }) + } + } + } +}