20 lines
565 B
TypeScript
20 lines
565 B
TypeScript
|
import { Command } from '../../../mod.ts'
|
||
|
import { CommandContext } from '../../models/command.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}!`)
|
||
|
}
|
||
|
}
|