Permissions - truemedian/Discordia GitHub Wiki

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

Methods

enable
disable
has
enableAll
disableAll
toHex
toTable
toArray
union
intersection
name
complement
copy

Properties

value

Methods

:enable( ... )

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

Name Type
... Permissions Resolvable

Returns: nil

:disable( ... )

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

Name Type
... Permissions Resolvable

Returns: nil

:has( ... )

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

Name Type
... Permissions Resolvable

Returns: boolean

:enableAll( )

Enables all permissions values.

Returns: nil

:disableAll( )

Disables all permissions values.

Returns: nil

: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

:toArray( )

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

Returns: table

:union( other )

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

Name Type
other Permissions

Returns: Permissions

:intersection( other )

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

Name Type
other Permissions

Returns: Permissions

:name( other )

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

Name Type
other Permissions

Returns: Permissions

:complement( other )

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

Name Type
other Permissions

Returns: Permissions

:copy( )

Returns a new copy of the original permissions object.

Returns: Permissions

Properties

.value

The raw decimal value that represents the permissions value.

Type: number

⚠️ **GitHub.com Fallback** ⚠️