diff options
Diffstat (limited to 'src/inhibitors/command/guildDisabledCommand.ts')
-rw-r--r-- | src/inhibitors/command/guildDisabledCommand.ts | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/inhibitors/command/guildDisabledCommand.ts b/src/inhibitors/command/guildDisabledCommand.ts new file mode 100644 index 0000000..d56e42c --- /dev/null +++ b/src/inhibitors/command/guildDisabledCommand.ts @@ -0,0 +1,22 @@ +import { BushCommand, BushInhibitor, BushMessage, BushSlashMessage } from '@lib'; + +export default class DisabledGuildCommandInhibitor extends BushInhibitor { + public constructor() { + super('disabledGuildCommand', { + reason: 'disabledGuild', + category: 'command', + type: 'post', + priority: 250 + }); + } + + public override async exec(message: BushMessage | BushSlashMessage, command: BushCommand): Promise<boolean> { + if (!message.guild || !message.guild) return false; + if (message.author.isOwner() || message.author.isSuperUser()) return false; // super users bypass guild disabled commands + + if ((await message.guild.getSetting('disabledCommands'))?.includes(command?.id)) { + return true; + } + return false; + } +} |