galactic-bot/structure/client/components/inhibitors/ChannelIgnore.js

34 lines
862 B
JavaScript
Raw Normal View History

2020-06-19 23:02:30 +02:00
const { Inhibitor } = require('../../../interfaces/');
class ChannelIgnore extends Inhibitor {
constructor(client) {
super(client, {
name: 'channelIgnore',
priority: 5,
guild: true
});
}
execute(message, command) {
if(message.member.admin) return super._succeed();
const { guild, member, channel } = message,
setting = guild._settings.ignore,
roles = member.roles.cache.map((r) => r.id);
2020-06-19 23:02:30 +02:00
if(!setting.enabled) return super._succeed();
if(setting.channels.includes(channel.id)) for(const role of roles) {
if(setting.roleBypass.includes(role)) return super._succeed();
return super._fail({ error: true, silent: true });
}
2020-06-19 23:02:30 +02:00
return super._succeed();
}
}
module.exports = ChannelIgnore;