Skip to main content

Locking commands to NSFW channels

Sometimes it can be necessary to lock certain commands to NSFW (not safe for work) channels. This can be simply achieved by setting the nsfw option in the command.

import { Command } from '@sapphire/framework';

export class NSFWCommand extends Command {
public constructor(context: Command.Context) {
super(context, {
// ...
nsfw: true
});
}
}
tip

To learn how to send a message to the command executor when a precondition fails, see Reporting Precondition Failure.