harmony/test/cmds/kickFromVoice.ts

20 lines
579 B
TypeScript
Raw Normal View History

2021-04-04 05:52:47 +00:00
import { Command, CommandContext } from '../../mod.ts'
2021-03-30 17:01:19 +00:00
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}`)
}
})
}
}
}
}