forked from Galactic/galactic-bot
27 lines
728 B
JavaScript
27 lines
728 B
JavaScript
const { Inhibitor } = require('../../../interfaces/');
|
|
|
|
class ClientPermissions extends Inhibitor {
|
|
|
|
constructor(client) {
|
|
|
|
super(client, {
|
|
name: 'clientPermissions',
|
|
priority: 11,
|
|
guarded: true,
|
|
guild: true
|
|
});
|
|
|
|
}
|
|
|
|
async execute(message, command) {
|
|
if (!message.guild.me) message.guild.me = await message.guild.members.fetch(message.client.user);
|
|
const missing = message.channel.permissionsFor(message.guild.me).missing(command.clientPermissions);
|
|
if(missing.length > 0) {
|
|
return super._fail({ missing: missing.join(', ') });
|
|
}
|
|
return super._succeed();
|
|
}
|
|
|
|
}
|
|
|
|
module.exports = ClientPermissions; |