1
0
mirror of https://github.com/musix-org/musix-oss synced 2024-11-14 03:30:18 +00:00
musix-oss/struct/funcs/check.js

28 lines
1.2 KiB
JavaScript
Raw Normal View History

2020-02-05 20:02:53 +00:00
module.exports = function (client, msg, command) {
2020-03-14 16:38:02 +00:00
const queue = client.queue.get(msg.guild.id);
2020-02-05 20:02:53 +00:00
const permissions = msg.channel.permissionsFor(msg.author);
2020-03-14 16:38:02 +00:00
if (!queue || !queue.playing) {
2020-03-13 14:20:23 +00:00
msg.channel.send(client.messages.noServerQueue);
return false;
}
2020-02-05 20:02:53 +00:00
if (msg.author.id !== client.config.devId) {
2020-03-14 16:38:02 +00:00
if (msg.member.voice.channel !== queue.voiceChannel) {
2020-03-13 14:20:23 +00:00
msg.channel.send(client.messages.wrongVoiceChannel);
return false;
}
2020-02-05 20:02:53 +00:00
if (client.global.db.guilds[msg.guild.id].permissions === true) {
if (client.global.db.guilds[msg.guild.id].dj) {
2020-02-24 18:31:54 +00:00
if (!msg.member.roles.cache.has(client.global.db.guilds[msg.guild.id].djrole)) {
2020-03-12 11:56:31 +00:00
msg.channel.send(client.messages.noDj);
2020-02-05 20:02:53 +00:00
return false;
} else return true;
} else if (!permissions.has(command.permission)) {
2020-03-13 14:20:23 +00:00
let message
message = client.messages.noPerms.replace("%PERMS%", commands.permissions);
msg.channel.send(message);
2020-02-05 20:02:53 +00:00
return false;
} else return true;
} else return true;
} else return true;
};