galactic-bot/structure/client/components/inhibitors/MemberPermissions.js
Navy d6a0f99601 A lot of shit
Co-authored-by: nolan <noooolaaaan@gmail.com>
2020-04-17 18:23:13 +03:00

29 lines
794 B
JavaScript

const { Inhibitor } = require('../../../interfaces/');
const { stripIndents } = require('common-tags');
class MemberPermissions extends Inhibitor {
constructor(client) {
super(client, {
name: 'memberPermissions',
priority: 10,
guarded: true,
guild: true
});
}
execute(message, command) {
const missing = message.channel.permissionsFor(message.member).missing(command.memberPermissions);
if(missing.length > 0) {
return super._fail(stripIndents`The command **${command.resolveable}** requires you to have permissions to use.
*Missing: ${missing.join(', ')}*`);
} else {
return super._succeed();
}
}
}
module.exports = MemberPermissions;