harmony/test/cmds/kickFromVoice.ts
2021-04-04 11:22:47 +05:30

19 lines
579 B
TypeScript

import { Command, CommandContext } from '../../mod.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}`)
}
})
}
}
}
}