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