Skip to main content

Class: UserPermissionsPrecondition

Constructs a contextful permissions precondition requirement.

since 1.0.0

example

export class CoreCommand extends Command {
public constructor(context: PieceContext) {
super(context, {
preconditions: [
'GuildOnly',
new UserPermissionsPrecondition('ADD_REACTIONS')
]
});
}

public messageRun(message: Message, args: Args) {
// ...
}
}

Implements

Constructors

constructor

โ€ข new UserPermissionsPrecondition(permissions)

Constructs a precondition container entry.

Parameters

NameTypeDescription
permissionsPermissionResolvableThe permissions that will be required by this command.

Defined in

projects/framework/src/lib/utils/preconditions/containers/UserPermissionsPrecondition.ts:33

Properties

context

โ€ข context: Object

The context to be set at PreconditionContainerSingle.context.

Type declaration

NameType
permissionsPermissions

Implementation of

PreconditionSingleResolvableDetails.context

Defined in

projects/framework/src/lib/utils/preconditions/containers/UserPermissionsPrecondition.ts:27


name

โ€ข name: "UserPermissions"

The name of the precondition to retrieve from {@link SapphireClient.preconditions}.

Implementation of

PreconditionSingleResolvableDetails.name

Defined in

projects/framework/src/lib/utils/preconditions/containers/UserPermissionsPrecondition.ts:26