PermissionsCheck class

A check that succeeds if the member invoking the command has a certain set of permissions.

You might also be interested in:

  • UserCheck, for checking if a command was executed by a specific user;
  • RoleCheck, for checking if a command was executed by a user with a specific role.
Inheritance

Constructors

PermissionsCheck(Flags<Permissions> permissions, {bool allowsOverrides = true, bool requiresAll = false, String? name, FutureOr<bool> allowsDm = true})
Create a new PermissionsCheck.
PermissionsCheck.nobody({bool allowsOverrides = true, String? name, bool allowsDm = true})
Create a PermissionsCheck that allows nobody to execute a command, unless configured otherwise by a permission override.

Properties

allowsDm FutureOr<bool>
Whether this check will allow commands to be executed in DM channels.
finalinherited
allowsOverrides bool
Whether this check should allow server administrators to configure overrides that allow specific users or channels to execute this command regardless of permissions.
final
hashCode int
The hash code for this object.
no setterinherited
name String
The name of this check.
finalinherited
permissions Flags<Permissions>
The bitfield representing the permissions required by this check.
final
postCallHooks Iterable<void Function(CommandContext context)>
An iterable of callbacks executed after a command is executed.
no setterinherited
preCallHooks Iterable<void Function(CommandContext context)>
An iterable of callbacks executed before a command is executed but after all the checks for that command have succeeded.
no setterinherited
requiredPermissions FutureOr<Flags<Permissions>?>
The permissions required from members to pass this check.
finalinherited
requiresAll bool
Whether this check requires the user invoking the command to have all of the permissions in permissions or only a single permission from permissions.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

check(CommandContext context) FutureOr<bool>
Validate context against this check.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited