PermissionOverwriteManager
PermissionOverwriteManager ⇐ Base
Section titled “PermissionOverwriteManager ⇐ Base”Represents a manager for permission overwrites in a channel.
Kind: global class
Extends: Base
- PermissionOverwriteManager ⇐
Base- new PermissionOverwriteManager(channelId, [overwrites], client)
- instance
- .cache ⇒
Collection - .resolve(overwrites) ⇒
PermissionOverwrite|undefined - .create(user, overwrites, [options]) ⇒
Promise.<void> - .set(overwrites, reason) ⇒
Promise - .edit(userOrRole, [options], [overwriteOptions]) ⇒
Promise.<Channel> - .delete(userOrRole, reason) ⇒
Promise.<Channel>
- .cache ⇒
- static
new PermissionOverwriteManager(channelId, [overwrites], client)
Section titled “new PermissionOverwriteManager(channelId, [overwrites], client)”Constructs a new instance of the Channel class.
| Param | Type | Description |
|---|---|---|
| channelId | string | The ID of the channel. |
| [overwrites] | object | The initial permission overwrites. |
| client | Client | The client instance. |
permissionOverwriteManager.cache ⇒ Collection
Section titled “permissionOverwriteManager.cache ⇒ Collection”Get the cache collection.
Kind: instance property of PermissionOverwriteManager
Returns: Collection - - The cache collection.
permissionOverwriteManager.resolve(overwrites) ⇒ PermissionOverwrite | undefined
Section titled “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.
| Param | Type | Description |
|---|---|---|
| overwrites | string | PermissionOverwriteOptions | The 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>
Section titled “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.
| Param | Type | Description |
|---|---|---|
| user | User | Role | string | The user or role to create or edit permission overwrites for. |
| overwrites | PermissionOverwriteOptions | The permission overwrites to apply. |
| [options] | CreateOptions | Additional options for creating or editing permission overwrites. |
| [options.reason] | string | The reason for creating or editing the permission overwrites. |
permissionOverwriteManager.set(overwrites, reason) ⇒ Promise
Section titled “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.
| Param | Type | Description |
|---|---|---|
| overwrites | Array | An array of permission overwrite objects. |
| reason | string | The reason for setting the permission overwrites. |
permissionOverwriteManager.edit(userOrRole, [options], [overwriteOptions]) ⇒ Promise.<Channel>
Section titled “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:
RangeErrorIf no user or role is specified.
| Param | Type | Description |
|---|---|---|
| userOrRole | string | User | Role | The user or role to edit permissions for. |
| [options] | Object | The options for the permission overwrite. |
| [overwriteOptions] | Object | The options for overwriting the permission overwrite. |
| [overwriteOptions.reason] | string | The reason for the permission overwrite. |
| [overwriteOptions.type] | string | The type of permission overwrite. |
permissionOverwriteManager.delete(userOrRole, reason) ⇒ Promise.<Channel>
Section titled “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.
| Param | Type | Description |
|---|---|---|
| userOrRole | string | User | Role | The user or role to delete the permission for. |
| reason | string | The reason for deleting the permission. |
PermissionOverwriteManager.editOverwrites(existing, overwrites, type) ⇒ object
Section titled “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.
| Param | Type | Description |
|---|---|---|
| existing | object | The existing overwrites object. |
| overwrites | object | The new overwrites to apply. |
| type | string | OverwriteType | The type of overwrite. |
PermissionOverwriteManager.transformOverwrites(existing, [overwrites], type) ⇒ Object
Section titled “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.
| Param | Type | Description |
|---|---|---|
| existing | Object | The existing overwrites object. |
| [overwrites] | Object | The new overwrites to apply. |
| type | string | The type of the overwrites. |