aboutsummaryrefslogtreecommitdiff
path: root/src/inhibitors/commands
diff options
context:
space:
mode:
Diffstat (limited to 'src/inhibitors/commands')
-rw-r--r--src/inhibitors/commands/disabledCommand.ts19
-rw-r--r--src/inhibitors/commands/globalDisabledCommand.ts19
-rw-r--r--src/inhibitors/commands/guildDisabledCommand.ts21
3 files changed, 40 insertions, 19 deletions
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;
+ }
+ }
+}