Skip to content
SinisterRectus edited this page Oct 23, 2022 · 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(value)

Parameter Type Optional
value number

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.

This method only operates on data in memory.

Returns: Permissions


fromMany(...)

Parameter Type
... Permission-Resolvables

Returns a Permissions object with all of the defined permissions.

This method only operates on data in memory.

Returns: Permissions


Methods

__eq()

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

This method only operates on data in memory.

Returns: boolean


__tostring()

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

This method only operates on data in memory.

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).

This method only operates on data in memory.

Returns: Permissions


copy()

Returns a new copy of the original permissions object.

This method only operates on data in memory.

Returns: Permissions


difference(other)

Parameter Type
other Permissions

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

This method only operates on data in memory.

Returns: Permissions


disable(...)

Parameter Type
... Permission-Resolvables

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

This method only operates on data in memory.

Returns: nil


disableAll()

Disables all permissions values.

This method only operates on data in memory.

Returns: nil


enable(...)

Parameter Type
... Permission-Resolvables

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

This method only operates on data in memory.

Returns: nil


enableAll()

Enables all permissions values.

This method only operates on data in memory.

Returns: nil


has(...)

Parameter Type
... Permission-Resolvables

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

This method only operates on data in memory.

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).

This method only operates on data in memory.

Returns: Permissions


toArray()

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

This method only operates on data in memory.

Returns: table


toHex()

Returns the hexadecimal string that represents the permissions value.

This method only operates on data in memory.

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.

This method only operates on data in memory.

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).

This method only operates on data in memory.

Returns: Permissions


Clone this wiki locally