This repository has been archived on 2024-03-06. You can view files and clone it, but cannot push or open issues or pull requests.
discord.js-rr-bot/Src/Structures/CommandOptions/ClientPermissions.js
2022-06-18 23:28:38 -04:00

25 lines
No EOL
1,023 B
JavaScript

module.exports = async function (message, command, Discord) {
if (!command.clientPermissions) return false;
let missing = []
command.clientPermissions.forEach(i => {
if (!message.guild.me.permissions.has(i)) missing.push(i)
})
if (missing.length == 0) return false;
else {
if (command.returnClientPermissions == false || command.returnNoErrors) return true;
else message.reply({
embeds: [new Discord.MessageEmbed()
.setAuthor({
name: message.member.user.tag,
iconURL: message.member.user.displayAvatarURL({ dynamic: true })
})
.setColor("RANDOM")
.setTimestamp()
.setDescription(`I require these permissions to be able to run this command.\n${missing.join("\n•")}`)],
allowedMentions: {
repliedUser: false
}
})
return true
}
}