eximiabots-radiox/src/client/funcs/check.js

21 lines
857 B
JavaScript
Raw Normal View History

2020-03-02 19:38:42 +00:00
module.exports = function (client, msg, command) {
let message = {};
2020-03-02 19:38:42 +00:00
const radio = client.radio.get(msg.guild.id);
const permissions = msg.channel.permissionsFor(msg.author);
if (!radio) {
msg.channel.send(client.messageEmojis["error"] + client.messages.notPlaying);
return false;
}
if (msg.member.voice.channel !== radio.voiceChannel) {
msg.channel.send(client.messageEmojis["error"] + client.messages.wrongVoiceChannel);
return false;
}
if(!command.permission == 'none'){
if (!permissions.has(command.permission)) {
message.noPerms = client.messages.noPerms.replace("%command.permission%", command.permission);
msg.channel.send(client.messageEmojis["error"] + message.noPerms);
return false;
} else return true;
2020-03-02 19:38:42 +00:00
} else return true;
};