PermissionLevels(sizeopt)

A helper class for building valid permission Structures

new PermissionLevels(sizeopt)

Creates a new PermissionLevels instance. Note that constructing any PermissionLevel instance will always insert a "Owner only" level for you at the highest number you specify automatically. You can still however remove this and change it after constructing.
Parameters:
Name Type Attributes Default Description
size number <optional>
10 The number of levels you want to allocate for this PermissionLevels instance

Members

levels :Array

Cached array of levels that get used for determining permissions.

size :number

The number of permission levels allowed in this instance. Technically this will be the size you input + 1 since Array[0] would be Level 0

Methods

add(level, brk, check) → {PermissionLevels}

Adds levels to the levels array to be used in your bot.
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
Returns:
PermissionLevels - This permission levels

reset(level) → {PermissionLevels}

Resets a level back to the default permission object.
Parameters:
Name Type Description
level number The level you want to reset.
Returns:
PermissionLevels - This permission levels.

Type Definitions

permLevel

Properties:
Name Type Description
break boolean Whether the level should break (stop processing higher levels, and inhibit a no permission error)
check function The permission checking function