diff options
Diffstat (limited to 'src/inhibitors/commands/globalDisabledCommand.ts')
-rw-r--r-- | src/inhibitors/commands/globalDisabledCommand.ts | 19 |
1 files changed, 19 insertions, 0 deletions
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; + } + } +} |