Skip to content

PermissionOverwriteManager

PermissionOverwriteManager ⇐ Base

Represents a manager for permission overwrites in a channel.

Kind: global class
Extends: Base

new PermissionOverwriteManager(channelId, [overwrites], client)

Constructs a new instance of the Channel class.

ParamTypeDescription
channelIdstringThe ID of the channel.
[overwrites]objectThe initial permission overwrites.
clientClientThe client instance.

permissionOverwriteManager.cache ⇒ Collection

Get the cache collection.

Kind: instance property of PermissionOverwriteManager
Returns: Collection - - The cache collection.

permissionOverwriteManager.resolve(overwrites) ⇒ PermissionOverwrite | undefined

Resolves the given overwrites parameter and returns a new PermissionOverwrite object.

Kind: instance method of PermissionOverwriteManager
Returns: PermissionOverwrite | undefined - A new PermissionOverwrite object if overwrites is provided, otherwise undefined.

ParamTypeDescription
overwritesstring | PermissionOverwriteOptionsThe overwrites to resolve. Can be a string representing the ID of the overwrite or an object containing the overwrite options.

permissionOverwriteManager.create(user, overwrites, [options]) ⇒ Promise.<void>

Creates or edits permission overwrites for a user or role in a channel.

Kind: instance method of PermissionOverwriteManager
Returns: Promise.<void> - - A promise that resolves when the permission overwrites are created or edited.
Throws:

  • RangeError - If no user or role is found.
ParamTypeDescription
userUser | Role | stringThe user or role to create or edit permission overwrites for.
overwritesPermissionOverwriteOptionsThe permission overwrites to apply.
[options]CreateOptionsAdditional options for creating or editing permission overwrites.
[options.reason]stringThe reason for creating or editing the permission overwrites.

permissionOverwriteManager.set(overwrites, reason) ⇒ Promise

Sets the permission overwrites for a channel.

Kind: instance method of PermissionOverwriteManager
Returns: Promise - A promise that resolves when the permission overwrites are set.

ParamTypeDescription
overwritesArrayAn array of permission overwrite objects.
reasonstringThe reason for setting the permission overwrites.

permissionOverwriteManager.edit(userOrRole, [options], [overwriteOptions]) ⇒ Promise.<Channel>

Edits the permissions for a user or role in the channel.

Kind: instance method of PermissionOverwriteManager
Returns: Promise.<Channel> - A promise that resolves with the updated channel object.
Throws:

  • RangeError If no user or role is specified.
ParamTypeDescription
userOrRolestring | User | RoleThe user or role to edit permissions for.
[options]ObjectThe options for the permission overwrite.
[overwriteOptions]ObjectThe options for overwriting the permission overwrite.
[overwriteOptions.reason]stringThe reason for the permission overwrite.
[overwriteOptions.type]stringThe type of permission overwrite.

permissionOverwriteManager.delete(userOrRole, reason) ⇒ Promise.<Channel>

Deletes the permission for a user or role in the channel.

Kind: instance method of PermissionOverwriteManager
Returns: Promise.<Channel> - A promise that resolves with the updated channel object.

ParamTypeDescription
userOrRolestring | User | RoleThe user or role to delete the permission for.
reasonstringThe reason for deleting the permission.

PermissionOverwriteManager.editOverwrites(existing, overwrites, type) ⇒ object

Edits the existing overwrites with the provided overwrites and type.

Kind: static method of PermissionOverwriteManager
Returns: object - - The updated overwrites object.

ParamTypeDescription
existingobjectThe existing overwrites object.
overwritesobjectThe new overwrites to apply.
typestring | OverwriteTypeThe type of overwrite.

PermissionOverwriteManager.transformOverwrites(existing, [overwrites], type) ⇒ Object

Transforms the existing overwrites with the provided overwrites and returns a new object with the updated allow and deny properties.

Kind: static method of PermissionOverwriteManager
Returns: Object - - The transformed overwrites object.

ParamTypeDescription
existingObjectThe existing overwrites object.
[overwrites]ObjectThe new overwrites to apply.
typestringThe type of the overwrites.