Skip to content
SinisterRectus edited this page Dec 8, 2018 · 17 revisions

Wrapper for a bitfield that is more specifically used to represent Discord permissions. See the permission enumeration for acceptable permission values.

Constructor

Permissions()

Properties

Name Type Description
value number The raw decimal value that represents the permissions value.

Static Methods

all()

Returns a Permissions object with all permissions.

Returns: Permissions

Methods

__eq()

Defines the behavior of the == operator. Allows permissions to be directly compared according to their value.

Returns: boolean

__tostring()

Defines the behavior of the tostring function. Returns a readable list of permissions stored for convenience of introspection.

Returns: string

complement(other)

Parameter Type
other Permissions

Returns a new Permissions object that contains the permissions that are not in self, but are in other (or the set of all permissions if omitted).

Returns: Permissions

copy()

Returns a new copy of the original permissions object.

Returns: Permissions

disable(...)

Parameter Type
... Permissions-Resolvable

Disables a specific permission or permissions. See the permission enumeration for acceptable permission values.

Returns: nil

disableAll()

Disables all permissions values.

Returns: nil

enable(...)

Parameter Type
... Permissions-Resolvable

Enables a specific permission or permissions. See the permission enumeration for acceptable permission values.

Returns: nil

enableAll()

Enables all permissions values.

Returns: nil

has(...)

Parameter Type
... Permissions-Resolvable

Returns whether this set has a specific permission or permissions. See the permission enumeration for acceptable permission values.

Returns: boolean

intersection(other)

Parameter Type
other Permissions

Returns a new Permissions object that contains the permissions that are in both self and other (bitwise AND).

Returns: Permissions

name(other)

Parameter Type
other Permissions

Returns a new Permissions object that contains the permissions that are not in self or other (bitwise XOR).

Returns: Permissions

toArray()

Returns an array of the names of the permissions that this objects represents.

Returns: table

toHex()

Returns the hexadecimal string that represents the permissions value.

Returns: string

toTable()

Returns a table that represents the permissions value, where the keys are the permission names and the values are true or false.

Returns: table

union(other)

Parameter Type
other Permissions

Returns a new Permissions object that contains the permissions that are in either self or other (bitwise OR).

Returns: Permissions

Clone this wiki locally