eximiabots-radiox/struct/check.js

13 lines
638 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);
2020-03-12 22:53:23 +00:00
if (!radio || !radio.playing) return msg.channel.send(client.messages.notPlaying);
if (msg.member.voice.channel !== radio.voiceChannel) return msg.channel.send(client.messages.wrongVoiceChannel);
if (!permissions.has(command.permission)) {
message.noPerms = client.messages.noPerms.replace("%commands.permissions%", commands.permissions);
msg.channel.send(message.noPerms);
2020-03-12 22:53:23 +00:00
return false;
2020-03-02 19:38:42 +00:00
} else return true;
};