Class: PermissionLevels

PermissionLevels

Permission levels. See Understanding Permission Levels for more information how to use this class to define custom permissions.

new PermissionLevels(levels)

Creates a new PermissionLevels
Parameters:
Name Type Default Description
levels number 11 How many permission levels there should be
Since:
  • 0.2.1
Source:
lib/structures/PermissionLevels.js#L23
Tutorials:

Extends

Properties


requiredLevels :number

The amount of permission levels
Type:
  • number
Since:
  • 0.2.1
Source:
lib/structures/PermissionLevels.js#L31

Methods


addLevel(level, brk, check)

Adds levels to the levels cache to be converted to valid permission structure
Parameters:
Name Type Description
level number The permission number for the level you are defining
brk boolean Whether the level should break (stop processing higher levels, and inhibit a no permission error)
check function The permission checking function
Since:
  • 0.2.1
Source:
lib/structures/PermissionLevels.js#L46
Returns:
This permission levels
Type
PermissionLevels

debug()

Returns any errors in the perm levels
Since:
  • 0.2.1
Source:
lib/structures/PermissionLevels.js#L78
Returns:
Error message(s)
Type
string

isValid()

Checks if all permission levels are valid
Since:
  • 0.2.1
Source:
lib/structures/PermissionLevels.js#L69
Returns:
Type
boolean

<async> run(msg, min)

Runs the defined permLevels
Parameters:
Name Type Description
msg external:Message The message to pass to perm level functions
min number The minimum permissionLevel ok to pass
Since:
  • 0.2.1
Source:
lib/structures/PermissionLevels.js#L95
Returns:
Type
permissionLevelResponse

Type Definitions


permissionLevelResponse

Type:
  • Object
Properties:
Name Type Description
broke boolean Whether the loop broke execution of higher levels
permission boolean Whether the permission level check passed or not
Source:
lib/structures/PermissionLevels.js#L11