eximiabots-radiox/src/client/funcs/check.js
2021-08-19 01:53:04 +03:00

21 lines
890 B
JavaScript

module.exports = function (client, msg, command) {
let message = {};
const radio = client.radio.get(interaction.guild.id);
const permissions = interaction.channel.permissionsFor(interaction.user);
if (!radio) {
interaction.reply(client.messageEmojis["error"] + client.messages.notPlaying);
return false;
}
if (interaction.member.voice.channel !== radio.voiceChannel) {
interaction.reply(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);
interaction.reply(client.messageEmojis["error"] + message.noPerms);
return false;
} else return true;
} else return true;
};