Add voice kick test

This commit is contained in:
Helloyunho 2021-03-31 02:01:19 +09:00
parent 064c3a6d76
commit d2cedeceb1
1 changed files with 20 additions and 0 deletions

View File

@ -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<void> {
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}`)
}
})
}
}
}
}