2020-04-17 17:23:13 +02:00
|
|
|
const { Inhibitor } = require('../../../interfaces/');
|
2020-04-16 14:37:04 +02:00
|
|
|
const { stripIndents } = require('common-tags');
|
|
|
|
|
|
|
|
class ClientPermissions extends Inhibitor {
|
|
|
|
|
|
|
|
constructor(client) {
|
|
|
|
|
|
|
|
super(client, {
|
|
|
|
name: 'clientPermissions',
|
|
|
|
priority: 11,
|
|
|
|
guarded: true,
|
|
|
|
guild: true
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
execute(message, command) {
|
2020-05-06 01:40:46 +02:00
|
|
|
const missing = message.channel.permissionsFor(message.guild.me).missing(command.clientPermissions);
|
2020-04-16 14:37:04 +02:00
|
|
|
if(missing.length > 0) {
|
|
|
|
return super._fail(stripIndents`The command **${command.resolveable}** requires the bot to have permissions to use.
|
|
|
|
*Missing: ${missing.join(', ')}*`);
|
2020-05-21 12:47:58 +02:00
|
|
|
}
|
|
|
|
return super._succeed();
|
2020-04-16 14:37:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = ClientPermissions;
|