diff options
Diffstat (limited to 'src/inhibitors/command/nsfw.ts')
-rw-r--r-- | src/inhibitors/command/nsfw.ts | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/inhibitors/command/nsfw.ts b/src/inhibitors/command/nsfw.ts new file mode 100644 index 0000000..563cb7a --- /dev/null +++ b/src/inhibitors/command/nsfw.ts @@ -0,0 +1,20 @@ +import { BushCommand, BushInhibitor, BushMessage, BushSlashMessage } from '@lib'; +import { TextChannel } from 'discord.js'; + +export default class NsfwInhibitor extends BushInhibitor { + public constructor() { + super('nsfw', { + reason: 'notNsfw', + category: 'command', + type: 'post', + priority: 25 + }); + } + + public override async exec(message: BushMessage | BushSlashMessage, command: BushCommand): Promise<boolean> { + if (command.onlyNsfw && !(message.channel as TextChannel).nsfw) { + return true; + } + return false; + } +} |