From ffa5128af2cc480a2b843388c5b1128532344592 Mon Sep 17 00:00:00 2001 From: Erik Date: Sat, 20 Jun 2020 00:02:30 +0300 Subject: [PATCH] channel ignoring inhibitor --- .../components/inhibitors/ChannelIgnore.js | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 structure/client/components/inhibitors/ChannelIgnore.js diff --git a/structure/client/components/inhibitors/ChannelIgnore.js b/structure/client/components/inhibitors/ChannelIgnore.js new file mode 100644 index 0000000..97ddae3 --- /dev/null +++ b/structure/client/components/inhibitors/ChannelIgnore.js @@ -0,0 +1,35 @@ +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; + + 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; \ No newline at end of file