Permissions class

const permissions = new Permissions(data, channel);

constructor

The Permissions class provides two required arguments. The first argument is the Discord.js PermissionOverwrites class where it can collect the data from. The second argument is a Zyno Bot addons channel where the permissions belong to.

Properties

channel

The channel where the permissions for the user or role belong to.

id

The id of the user or role where the permissions apply to.

type

A string which is either Role or Member and defines the target for who the permissions apply to.

allow

A Discord.js PermissionsBitField class which defines the permissions the user or role has in this channel.

deny

A Discord.js PermissionsBitField class which defines the permissions the user or role doesn't have.

Functions

delete

permissions.delete(reason?: string) : Promise<void>;

Deletes the permissions for the user or role in this channel. The function returns a Promise which will return a void once it's fulfilled.

ArgumentDescription

reason

The reason you want to delete the permissions for the user or role. This must be a string between 1-512 characters, but is not required.

edit

permissions.edit(option: editOptions, reason?: string) : Promise<Permissions>;

Changes the permissions for the user or role. The function returns a Promise which will return the Permissions class with the new permissions for the user or role once it's fulfilled.

ArgumentDescription

editOptions

An object where the key is the name of the permission you want to change and the value a boolean which defines whether the user or role should be allowed to have this permission or not. The permission names can be found on the permissionsBitfield page.

reason

The reason you want to change the permissions for the user or role. This must be a string between 1-512 characters, but is not required.

Last updated