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

18 lines
520 B
TypeScript

import { Command, CommandContext } from '../../mod.ts'
export default class LeaveCommand extends Command {
name = 'leave'
guildOnly = true
async execute(ctx: CommandContext): Promise<void> {
const userVS = await ctx.guild?.voiceStates.get(
(ctx.client.user?.id as unknown) as string
)
if (userVS === undefined) {
ctx.message.reply("I'm not in VC.")
return
}
userVS.channel?.leave()
ctx.message.reply(`Left VC channel - ${userVS.channel?.name}!`)
}
}