aboutsummaryrefslogtreecommitdiff
path: root/src/inhibitors
diff options
context:
space:
mode:
Diffstat (limited to 'src/inhibitors')
-rw-r--r--src/inhibitors/blacklist/blacklist.ts14
-rw-r--r--src/inhibitors/blacklist/guildBlacklist.ts19
-rw-r--r--src/inhibitors/blacklist/userBlacklist.ts19
-rw-r--r--src/inhibitors/commands/disabledCommand.ts19
-rw-r--r--src/inhibitors/noCache.ts21
5 files changed, 78 insertions, 14 deletions
diff --git a/src/inhibitors/blacklist/blacklist.ts b/src/inhibitors/blacklist/blacklist.ts
deleted file mode 100644
index 309815f..0000000
--- a/src/inhibitors/blacklist/blacklist.ts
+++ /dev/null
@@ -1,14 +0,0 @@
-import { BushInhibitor } from '../../lib/extensions/BushInhibitor';
-
-export default class BlacklistInhibitor extends BushInhibitor {
- constructor() {
- super('blacklist', {
- reason: 'blacklist'
- });
- }
-
- public exec(): boolean | Promise<boolean> {
- // This is just a placeholder for now
- return false;
- }
-}
diff --git a/src/inhibitors/blacklist/guildBlacklist.ts b/src/inhibitors/blacklist/guildBlacklist.ts
new file mode 100644
index 0000000..93d8aee
--- /dev/null
+++ b/src/inhibitors/blacklist/guildBlacklist.ts
@@ -0,0 +1,19 @@
+import { BushInhibitor } from '../../lib/extensions/BushInhibitor';
+import { BushSlashMessage } from '../../lib/extensions/BushInteractionMessage';
+import { BushMessage } from '../../lib/extensions/BushMessage';
+
+export default class GuildBlacklistInhibitor extends BushInhibitor {
+ constructor() {
+ super('guildBlacklist', {
+ reason: 'guildBlacklist',
+ category: 'blacklist',
+ type: 'all'
+ });
+ }
+
+ 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;
+ return this.client.cache.global.blacklistedGuilds.includes(message.guild.id);
+ }
+}
diff --git a/src/inhibitors/blacklist/userBlacklist.ts b/src/inhibitors/blacklist/userBlacklist.ts
new file mode 100644
index 0000000..bbced28
--- /dev/null
+++ b/src/inhibitors/blacklist/userBlacklist.ts
@@ -0,0 +1,19 @@
+import { BushInhibitor } from '../../lib/extensions/BushInhibitor';
+import { BushSlashMessage } from '../../lib/extensions/BushInteractionMessage';
+import { BushMessage } from '../../lib/extensions/BushMessage';
+
+export default class UserBlacklistInhibitor extends BushInhibitor {
+ 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;
+ return this.client.cache.global.blacklistedUsers.includes(message.author.id);
+ }
+}
diff --git a/src/inhibitors/commands/disabledCommand.ts b/src/inhibitors/commands/disabledCommand.ts
new file mode 100644
index 0000000..8538858
--- /dev/null
+++ b/src/inhibitors/commands/disabledCommand.ts
@@ -0,0 +1,19 @@
+import { BushCommand } from '../../lib/extensions/BushCommand';
+import { BushInhibitor } from '../../lib/extensions/BushInhibitor';
+import { BushSlashMessage } from '../../lib/extensions/BushInteractionMessage';
+import { BushMessage } from '../../lib/extensions/BushMessage';
+
+export default class DisabledCommandInhibitor extends BushInhibitor {
+ 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;
+ return this.client.cache.global.disabledCommands.includes(command?.id);
+ }
+}
diff --git a/src/inhibitors/noCache.ts b/src/inhibitors/noCache.ts
new file mode 100644
index 0000000..61f0b3e
--- /dev/null
+++ b/src/inhibitors/noCache.ts
@@ -0,0 +1,21 @@
+import { BushInhibitor } from '../lib/extensions/BushInhibitor';
+import { BushSlashMessage } from '../lib/extensions/BushInteractionMessage';
+import { BushMessage } from '../lib/extensions/BushMessage';
+
+export default class noCacheInhibitor extends BushInhibitor {
+ constructor() {
+ super('noCache', {
+ reason: 'noCache',
+ type: 'all',
+ priority: 100
+ });
+ }
+
+ public async exec(message: BushMessage | BushSlashMessage): Promise<boolean> {
+ if (this.client.isOwner(message.author)) return false;
+ for (const property in this.client.cache) {
+ if (property === undefined || property === null) return true;
+ }
+ return false;
+ }
+}