PermissionOverwriteManager
classe · Source
Manages API methods for guild channel permission overwrites and stores their cache.
Extends: CachedManager
Properties
channel
The channel of the permission overwrite this manager belongs to Source
cache
The cache of this Manager Source
_cache
readonly · private
The private cache of items for this manager. Source
holds
readonly · private
The data structure belonging to this manager. Source
client
readonly
The client that instantiated this Manager Source
Methods
set
async
Replaces the permission overwrites in this channel. Parameters
| Name | Type | Description |
|---|---|---|
overwrites | Array<OverwriteResolvable> | Collection<Snowflake, OverwriteResolvable> | Permission overwrites the channel gets updated with |
reason? | string | Reason for updating the channel overwrites |
Returns: Promise<GuildChannel>
message.channel.permissionOverwrites.set([
{
id: message.author.id,
deny: [Permissions.FLAGS.VIEW_CHANNEL],
},
], 'Needed to change permissions');2
3
4
5
6
upsert
async · private
Creates or edits permission overwrites for a user or role in this channel. Parameters
| Name | Type | Description |
|---|---|---|
userOrRole | RoleResolvable | UserResolvable | The user or role to update |
options | PermissionOverwriteOptions | The options for the update |
overwriteOptions? | GuildChannelOverwriteOptions | The extra information for the update |
existing? | PermissionOverwrites | The existing overwrites to merge with this update |
Returns: Promise<GuildChannel>Source
create
Creates permission overwrites for a user or role in this channel, or replaces them if already present. Parameters
| Name | Type | Description |
|---|---|---|
userOrRole | RoleResolvable | UserResolvable | The user or role to update |
options | PermissionOverwriteOptions | The options for the update |
overwriteOptions? | GuildChannelOverwriteOptions | The extra information for the update |
Returns: Promise<GuildChannel>
// Create or Replace permission overwrites for a message author
message.channel.permissionOverwrites.create(message.author, {
SEND_MESSAGES: false
})
.then(channel => console.log(channel.permissionOverwrites.cache.get(message.author.id)))
.catch(console.error);2
3
4
5
6
edit
Edits permission overwrites for a user or role in this channel, or creates an entry if not already present. Parameters
| Name | Type | Description |
|---|---|---|
userOrRole | RoleResolvable | UserResolvable | The user or role to update |
options | PermissionOverwriteOptions | The options for the update |
overwriteOptions? | GuildChannelOverwriteOptions | The extra information for the update |
Returns: Promise<GuildChannel>
// Edit or Create permission overwrites for a message author
message.channel.permissionOverwrites.edit(message.author, {
SEND_MESSAGES: false
})
.then(channel => console.log(channel.permissionOverwrites.cache.get(message.author.id)))
.catch(console.error);2
3
4
5
6
delete
async
Deletes permission overwrites for a user or role in this channel. Parameters
| Name | Type | Description |
|---|---|---|
userOrRole | UserResolvable | RoleResolvable | The user or role to delete |
reason? | string | The reason for deleting the overwrite |
Returns: Promise<GuildChannel>Source
resolve
Resolves a data entry to a data Object. Parameters
| Name | Type | Description |
|---|---|---|
idOrInstance | string | Object | The id or instance of something in this Manager |
Returns: Object — An instance from this Manager Source
resolveId
Resolves a data entry to an instance id. Parameters
| Name | Type | Description |
|---|---|---|
idOrInstance | string | Object | The id or instance of something in this Manager |
Returns: SnowflakeSource