✅ Add voice kick test
This commit is contained in:
parent
064c3a6d76
commit
d2cedeceb1
1 changed files with 20 additions and 0 deletions
20
src/test/cmds/kickFromVoice.ts
Normal file
20
src/test/cmds/kickFromVoice.ts
Normal 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}`)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue