diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-07-17 10:25:46 -0400 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-07-17 10:25:46 -0400 |
commit | d1724227abfb8f0fcd9e573f7e9772cf0be8257a (patch) | |
tree | 52c9dbae1fbbbd3c777d9c16ab643c477141ae21 /src/inhibitors/blacklist | |
parent | 53d2b18f7f73d5696fb7cd86d1c164a790dfdcc3 (diff) | |
download | tanzanite-d1724227abfb8f0fcd9e573f7e9772cf0be8257a.tar.gz tanzanite-d1724227abfb8f0fcd9e573f7e9772cf0be8257a.tar.bz2 tanzanite-d1724227abfb8f0fcd9e573f7e9772cf0be8257a.zip |
honestly no idea what I did at this point
Diffstat (limited to 'src/inhibitors/blacklist')
-rw-r--r-- | src/inhibitors/blacklist/channelGlobalBlacklist.ts | 25 | ||||
-rw-r--r-- | src/inhibitors/blacklist/channelGuildBlacklist.ts | 25 | ||||
-rw-r--r-- | src/inhibitors/blacklist/guildBlacklist.ts | 8 | ||||
-rw-r--r-- | src/inhibitors/blacklist/userBlacklist.ts | 20 | ||||
-rw-r--r-- | src/inhibitors/blacklist/userGlobalBlacklist.ts | 25 | ||||
-rw-r--r-- | src/inhibitors/blacklist/userGuildBlacklist.ts | 25 |
6 files changed, 107 insertions, 21 deletions
diff --git a/src/inhibitors/blacklist/channelGlobalBlacklist.ts b/src/inhibitors/blacklist/channelGlobalBlacklist.ts new file mode 100644 index 0000000..9dc5df9 --- /dev/null +++ b/src/inhibitors/blacklist/channelGlobalBlacklist.ts @@ -0,0 +1,25 @@ +import { BushInhibitor, BushMessage, BushSlashMessage } from '@lib'; + +export default class UserGlobalBlacklistInhibitor extends BushInhibitor { + public constructor() { + super('channelGlobalBlacklist', { + reason: 'channelGlobalBlacklist', + category: 'blacklist', + type: 'all' + }); + } + + public exec(message: BushMessage | BushSlashMessage): boolean { + if (!message.author) return false; + if ( + this.client.isOwner(message.author) || + this.client.isSuperUser(message.author) || + this.client.user.id === message.author.id + ) + return false; + if (this.client.cache.global.blacklistedChannels.includes(message.channel.id)) { + this.client.console.debug(`channelGlobalBlacklist blocked message.`); + return true; + } + } +} diff --git a/src/inhibitors/blacklist/channelGuildBlacklist.ts b/src/inhibitors/blacklist/channelGuildBlacklist.ts new file mode 100644 index 0000000..cc72182 --- /dev/null +++ b/src/inhibitors/blacklist/channelGuildBlacklist.ts @@ -0,0 +1,25 @@ +import { BushInhibitor, BushMessage, BushSlashMessage } from '@lib'; + +export default class ChannelGuildBlacklistInhibitor extends BushInhibitor { + public constructor() { + super('channelGuildBlacklist', { + reason: 'channelGuildBlacklist', + category: 'blacklist', + type: 'all' + }); + } + + public async exec(message: BushMessage | BushSlashMessage): Promise<boolean> { + if (!message.author || !message.guild) return false; + if ( + this.client.isOwner(message.author) || + this.client.isSuperUser(message.author) || + this.client.user.id === message.author.id + ) + return false; + if ((await message.guild.getSetting('blacklistedChannels'))?.includes(message.channel.id)) { + this.client.console.debug(`channelGuildBlacklist blocked message.`); + return true; + } + } +} diff --git a/src/inhibitors/blacklist/guildBlacklist.ts b/src/inhibitors/blacklist/guildBlacklist.ts index d9a42da..7d08157 100644 --- a/src/inhibitors/blacklist/guildBlacklist.ts +++ b/src/inhibitors/blacklist/guildBlacklist.ts @@ -11,7 +11,13 @@ export default class GuildBlacklistInhibitor extends BushInhibitor { public exec(message: BushMessage | BushSlashMessage): boolean { if (!message.guild) return false; - if (message.author && (this.client.isOwner(message.author) || this.client.isSuperUser(message.author))) return false; + if ( + message.author && + (this.client.isOwner(message.author) || + this.client.isSuperUser(message.author) || + this.client.user.id === message.author.id) + ) + return false; if (this.client.cache.global.blacklistedGuilds.includes(message.guild.id)) { this.client.console.debug(`GuildBlacklistInhibitor blocked message.`); return true; diff --git a/src/inhibitors/blacklist/userBlacklist.ts b/src/inhibitors/blacklist/userBlacklist.ts deleted file mode 100644 index f3cc642..0000000 --- a/src/inhibitors/blacklist/userBlacklist.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { BushInhibitor, BushMessage, BushSlashMessage } from '@lib'; - -export default class UserBlacklistInhibitor extends BushInhibitor { - public constructor() { - super('userBlacklist', { - reason: 'userBlacklist', - category: 'blacklist', - type: 'all' - }); - } - - public exec(message: BushMessage | BushSlashMessage): boolean { - if (!message.author) return false; - if (this.client.isOwner(message.author) || this.client.isSuperUser(message.author)) return false; - if (this.client.cache.global.blacklistedUsers.includes(message.author.id)) { - this.client.console.debug(`UserBlacklistInhibitor blocked message.`); - return true; - } - } -} diff --git a/src/inhibitors/blacklist/userGlobalBlacklist.ts b/src/inhibitors/blacklist/userGlobalBlacklist.ts new file mode 100644 index 0000000..061bae9 --- /dev/null +++ b/src/inhibitors/blacklist/userGlobalBlacklist.ts @@ -0,0 +1,25 @@ +import { BushInhibitor, BushMessage, BushSlashMessage } from '@lib'; + +export default class UserGlobalBlacklistInhibitor extends BushInhibitor { + public constructor() { + super('userGlobalBlacklist', { + reason: 'userGlobalBlacklist', + category: 'blacklist', + type: 'all' + }); + } + + public exec(message: BushMessage | BushSlashMessage): boolean { + if (!message.author) return false; + if ( + this.client.isOwner(message.author) || + this.client.isSuperUser(message.author) || + this.client.user.id === message.author.id + ) + return false; + if (this.client.cache.global.blacklistedUsers.includes(message.author.id)) { + this.client.console.debug(`userGlobalBlacklist blocked message.`); + return true; + } + } +} diff --git a/src/inhibitors/blacklist/userGuildBlacklist.ts b/src/inhibitors/blacklist/userGuildBlacklist.ts new file mode 100644 index 0000000..02a3762 --- /dev/null +++ b/src/inhibitors/blacklist/userGuildBlacklist.ts @@ -0,0 +1,25 @@ +import { BushInhibitor, BushMessage, BushSlashMessage } from '@lib'; + +export default class UserGuildBlacklistInhibitor extends BushInhibitor { + public constructor() { + super('userGuildBlacklist', { + reason: 'userGuildBlacklist', + category: 'blacklist', + type: 'all' + }); + } + + public async exec(message: BushMessage | BushSlashMessage): Promise<boolean> { + if (!message.author || !message.guild) return false; + if ( + this.client.isOwner(message.author) || + this.client.isSuperUser(message.author) || + this.client.user.id === message.author.id + ) + return false; + if ((await message.guild.getSetting('blacklistedUsers'))?.includes(message.author.id)) { + this.client.console.debug(`userGuildBlacklist blocked message.`); + return true; + } + } +} |