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 levelnumber The permission number for the level you are defining brkboolean Whether the level should break (stop processing higher levels, and inhibit a no permission error) checkfunction 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 msgexternal:Message The message to pass to perm level functions minnumber The minimum permissionLevel ok to pass - Since:
-
- 0.2.1
- Source:
- lib/structures/PermissionLevels.js#L95
Returns:
- Type
- permissionLevelResponse
Type Definitions
-
permissionLevelResponse
-
Type:
- Object
- Source:
- lib/structures/PermissionLevels.js#L11
Properties:
Name Type Description brokeboolean Whether the loop broke execution of higher levels permissionboolean Whether the permission level check passed or not