forked from Galactic/galactic-bot
37 lines
922 B
JavaScript
37 lines
922 B
JavaScript
const { Inhibitor } = require('../../../interfaces/');
|
|
|
|
class ChannelIgnore extends Inhibitor {
|
|
|
|
constructor(client) {
|
|
|
|
super(client, {
|
|
name: 'channelIgnore',
|
|
priority: 5,
|
|
guild: true,
|
|
silent: true
|
|
});
|
|
|
|
}
|
|
|
|
execute(message) {
|
|
|
|
if(message.member.admin) return super._succeed();
|
|
|
|
const { guild, member, channel } = message,
|
|
setting = guild._settings.ignoreChannels,
|
|
roles = member.roles.cache.map((r) => r.id);
|
|
|
|
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 });
|
|
}
|
|
return super._succeed();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
module.exports = ChannelIgnore; |