1
0
mirror of https://github.com/musix-org/musix-oss synced 2024-11-10 11:20:19 +00:00
musix-oss/struct/funcs/check.js
MatteZ02 a64f9d2325 Update 3.0.3
All messages reworked.
2020-03-12 13:56:31 +02:00

21 lines
1.1 KiB
JavaScript

module.exports = function (client, msg, command) {
const serverQueue = client.queue.get(msg.guild.id);
const permissions = msg.channel.permissionsFor(msg.author);
if (!serverQueue || !serverQueue.playing) return msg.channel.send(client.messages.noServerQueue);
if (msg.author.id !== client.config.devId) {
if (msg.member.voice.channel !== serverQueue.voiceChannel) return msg.channel.send(client.messages.wrongVoiceChannel);
if (client.global.db.guilds[msg.guild.id].permissions === true) {
if (client.global.db.guilds[msg.guild.id].dj) {
if (!msg.member.roles.cache.has(client.global.db.guilds[msg.guild.id].djrole)) {
msg.channel.send(client.messages.noDj);
return false;
} else return true;
} else if (!permissions.has(command.permission)) {
client.messages.noPerms = client.messages.noPerms.replace("%PERMS%", commands.permissions);
msg.channel.send(client.messages.noPerms);
return false;
} else return true;
} else return true;
} else return true;
};