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