diff options
Diffstat (limited to 'commands/voice/leave.js')
| -rw-r--r-- | commands/voice/leave.js | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/commands/voice/leave.js b/commands/voice/leave.js new file mode 100644 index 0000000..13009eb --- /dev/null +++ b/commands/voice/leave.js @@ -0,0 +1,30 @@ +const { Command } = require('discord.js-commando'); + +module.exports = class LeaveVoice extends Command { + constructor(client) { + super(client, { + name: 'leave', + aliases: ['end', 'stop'], + group: 'voice', + memberName: 'leave', + description: 'stops voice channel if any playing', + guildOnly: true + }); + } + run(msg) { + var voiceChannel = msg.member.voice.channel; + if (!voiceChannel) return msg.reply('join a channel and try again'); + + if ( + typeof msg.guild.musicData.songDispatcher == 'undefined' || + msg.guild.musicData.songDispatcher == null + ) { + return msg.reply('there isn\'t a song playing right now lol'); + } + if (!msg.guild.musicData.queue) + return msg.say('there are no songs in queue rn lol'); + msg.guild.musicData.songDispatcher.end(); + msg.guild.musicData.queue.length = 0; + return; + } +};
\ No newline at end of file |