Leave Voice Channel Command

This commit is contained in:
Daniel Odendahl Jr
2018-03-24 16:05:02 +00:00
parent 9280c79300
commit 9383fa72e0
3 changed files with 24 additions and 2 deletions
+21
View File
@@ -0,0 +1,21 @@
const { Command } = require('discord.js-commando');
module.exports = class LeaveVoiceChannelCommand extends Command {
constructor(client) {
super(client, {
name: 'leave-voice-channel',
aliases: ['leave-vc'],
group: 'voice',
memberName: 'leave',
description: 'Leaves a voice channel, in case the bot gets stuck.',
guildOnly: true
});
}
run(msg) {
if (!this.client.voiceConnections.has(msg.guild.id)) return msg.reply('I am not in a voice channel...');
const { channel } = this.client.voiceConnections.get(msg.guild.id);
channel.leave();
return msg.say(`Left **${channel.name}**.`);
}
};