diff options
Diffstat (limited to 'commands/leave.js')
| -rw-r--r-- | commands/leave.js | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/commands/leave.js b/commands/leave.js index 9a54555..a2a48d8 100644 --- a/commands/leave.js +++ b/commands/leave.js @@ -1,7 +1,7 @@ /**************************************** * * Leave: Command for AleeBot - * Copyright (C) 2018 AleeCorp + * Copyright (C) 2018 AleeCorp & (your name here) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,10 +17,18 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * * *************************************/ -module.exports.run = async (client, message) => { - if (!['242775871059001344', message.guild.owner.user.id].includes(message.author.id)) return message.reply('Nope! You need the person who created this bot or the owner of this guild to use this command.'); - message.channel.send('Alright, I\'m leaving the server now. Bye everyone!') - message.guild.leave(); + +module.exports.run = async (client, message, args) => { + if (!message.member.voiceChannel) return message.reply('You need a voice channel to perform this action.'); + + if (!message.guild.me.voiceChannel) return message.reply('Error: The bot isn\'t connected to a voice channel.') + + if (message.guild.me.voiceChannelID !== message.member.voiceChannelID) return message.reply('Error: You aren\'t connected in the same voice channel as the bot...'); + + message.guild.me.voiceChannel.leave(); + + message.channel.send("Leaving channel...") + }; exports.conf = { @@ -29,8 +37,7 @@ module.exports.run = async (client, message) => { }; exports.help = { name: 'leave', - description: 'Makes the bot leave the server', + description: 'Leaves voice chat.', usage: 'leave', - category: '- Owners Only', - }; -
\ No newline at end of file + category: '- Music Commands', + };
\ No newline at end of file |
