aboutsummaryrefslogtreecommitdiff
path: root/src/inhibitors
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-07-17 10:25:46 -0400
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-07-17 10:25:46 -0400
commitd1724227abfb8f0fcd9e573f7e9772cf0be8257a (patch)
tree52c9dbae1fbbbd3c777d9c16ab643c477141ae21 /src/inhibitors
parent53d2b18f7f73d5696fb7cd86d1c164a790dfdcc3 (diff)
downloadtanzanite-d1724227abfb8f0fcd9e573f7e9772cf0be8257a.tar.gz
tanzanite-d1724227abfb8f0fcd9e573f7e9772cf0be8257a.tar.bz2
tanzanite-d1724227abfb8f0fcd9e573f7e9772cf0be8257a.zip
honestly no idea what I did at this point
Diffstat (limited to 'src/inhibitors')
-rw-r--r--src/inhibitors/blacklist/channelGlobalBlacklist.ts25
-rw-r--r--src/inhibitors/blacklist/channelGuildBlacklist.ts25
-rw-r--r--src/inhibitors/blacklist/guildBlacklist.ts8
-rw-r--r--src/inhibitors/blacklist/userBlacklist.ts20
-rw-r--r--src/inhibitors/blacklist/userGlobalBlacklist.ts25
-rw-r--r--src/inhibitors/blacklist/userGuildBlacklist.ts25
-rw-r--r--src/inhibitors/commands/disabledCommand.ts19
-rw-r--r--src/inhibitors/commands/globalDisabledCommand.ts19
-rw-r--r--src/inhibitors/commands/guildDisabledCommand.ts21
9 files changed, 147 insertions, 40 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;
+ }
+ }
+}
diff --git a/src/inhibitors/commands/disabledCommand.ts b/src/inhibitors/commands/disabledCommand.ts
deleted file mode 100644
index fb31375..0000000
--- a/src/inhibitors/commands/disabledCommand.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-import { BushCommand, BushInhibitor, BushMessage, BushSlashMessage } from '@lib';
-
-export default class DisabledCommandInhibitor extends BushInhibitor {
- public constructor() {
- super('disabledCommand', {
- reason: 'disabled',
- type: 'pre',
- priority: 3
- });
- }
-
- public async exec(message: BushMessage | BushSlashMessage, command: BushCommand): Promise<boolean> {
- if (this.client.isOwner(message.author)) return false;
- if (this.client.cache.global.disabledCommands.includes(command?.id)) {
- this.client.console.debug(`DisabledCommandInhibitor blocked message.`);
- return true;
- }
- }
-}
diff --git a/src/inhibitors/commands/globalDisabledCommand.ts b/src/inhibitors/commands/globalDisabledCommand.ts
new file mode 100644
index 0000000..3ce39c2
--- /dev/null
+++ b/src/inhibitors/commands/globalDisabledCommand.ts
@@ -0,0 +1,19 @@
+import { BushCommand, BushInhibitor, BushMessage, BushSlashMessage } from '@lib';
+
+export default class DisabledGuildCommandInhibitor extends BushInhibitor {
+ public constructor() {
+ super('disabledGlobalCommand', {
+ reason: 'disabledGlobal',
+ type: 'pre',
+ priority: 4
+ });
+ }
+
+ public async exec(message: BushMessage | BushSlashMessage, command: BushCommand): Promise<boolean> {
+ if (message.author.isOwner()) return false;
+ if (this.client.cache.global.disabledCommands?.includes(command?.id)) {
+ this.client.console.debug(`disabledGlobalCommand blocked message.`);
+ return true;
+ }
+ }
+}
diff --git a/src/inhibitors/commands/guildDisabledCommand.ts b/src/inhibitors/commands/guildDisabledCommand.ts
new file mode 100644
index 0000000..a036ec5
--- /dev/null
+++ b/src/inhibitors/commands/guildDisabledCommand.ts
@@ -0,0 +1,21 @@
+import { BushCommand, BushInhibitor, BushMessage, BushSlashMessage } from '@lib';
+
+export default class DisabledGuildCommandInhibitor extends BushInhibitor {
+ public constructor() {
+ super('disabledGuildCommand', {
+ reason: 'disabledGuild',
+ type: 'pre',
+ priority: 3
+ });
+ }
+
+ public async exec(message: BushMessage | BushSlashMessage, command: BushCommand): Promise<boolean> {
+ if (!message.guild || !message.guild) return;
+ if (message.author.isOwner() || message.author.isSuperUser()) return false; // super users bypass guild disabled commands
+
+ if ((await message.guild.getSetting('disabledCommands'))?.includes(command?.id)) {
+ this.client.console.debug(`disabledGuildCommand blocked message.`);
+ return true;
+ }
+ }
+}