PermissionOverwriteManager

export class PermissionOverwriteManager extends CachedManager<Snowflake, PermissionOverwrites, PermissionOverwriteResolvable>
export class PermissionOverwriteManager extends CachedManager<Snowflake, PermissionOverwrites, PermissionOverwriteResolvable>
Manages API methods for guild channel permission overwrites and stores their cache.
Readonly
cache:Collection<Key, Holds>
The cache of items for this manager.
Inherited from DataManager
channel:GuildChannel
The channel of the permission overwrite this manager belongs to
Readonly
client:Client
The client that instantiated this Manager
Inherited from BaseManager
Readonly
holds:Constructable<Holds>
The data structure belonging to this manager.
Inherited from DataManager
create(userOrRole, options, overwriteOptions?):Promise<NonThreadGuildBasedChannel>
Creates permission overwrites for a user or role in this channel, or replaces them if already present.
Example
// Create or Replace permission overwrites for a message author
message.channel.permissionOverwrites.create(message.author, {
SendMessages: false
})
.then(channel => console.log(channel.permissionOverwrites.cache.get(message.author.id)))
.catch(console.error);
// Create or Replace permission overwrites for a message author
message.channel.permissionOverwrites.create(message.author, {
SendMessages: false
})
.then(channel => console.log(channel.permissionOverwrites.cache.get(message.author.id)))
.catch(console.error);
NameTypeOptionalDescription
userOrRoleRoleResolvable | UserResolvableNoThe user or role to update
optionsPermissionOverwriteOptionsNoThe options for the update
overwriteOptionsGuildChannelOverwriteOptionsYesThe extra information for the update
delete(userOrRole, reason?):Promise<NonThreadGuildBasedChannel>
Deletes permission overwrites for a user or role in this channel.
NameTypeOptionalDescription
userOrRoleRoleResolvable | UserResolvableNoThe user or role to delete
reasonstringYesThe reason for deleting the overwrite
edit(userOrRole, options, overwriteOptions?):Promise<NonThreadGuildBasedChannel>
Edits permission overwrites for a user or role in this channel, or creates an entry if not already present.
Example
// Edit or Create permission overwrites for a message author
message.channel.permissionOverwrites.edit(message.author, {
SendMessages: false
})
.then(channel => console.log(channel.permissionOverwrites.cache.get(message.author.id)))
.catch(console.error);
// Edit or Create permission overwrites for a message author
message.channel.permissionOverwrites.edit(message.author, {
SendMessages: false
})
.then(channel => console.log(channel.permissionOverwrites.cache.get(message.author.id)))
.catch(console.error);
NameTypeOptionalDescription
userOrRoleRoleResolvable | UserResolvableNoThe user or role to update
optionsPermissionOverwriteOptionsNoThe options for the update
overwriteOptionsGuildChannelOverwriteOptionsYesThe extra information for the update
resolve(idOrInstance):Holds
Resolves a data entry to a data Object.
Returns
An instance from this Manager
NameTypeOptionalDescription
idOrInstanceHoldsNoThe id or instance of something in this Manager
resolveId(idOrInstance):Key
Resolves a data entry to an instance id.
Returns
NameTypeOptionalDescription
idOrInstanceKey | HoldsNoThe id or instance of something in this Manager
set(overwrites, reason?):Promise<NonThreadGuildBasedChannel>
Replaces the permission overwrites in this channel.
Example
message.channel.permissionOverwrites.set([
{
id: message.author.id,
deny: [PermissionFlagsBits.ViewChannel],
},
], 'Needed to change permissions');
message.channel.permissionOverwrites.set([
{
id: message.author.id,
deny: [PermissionFlagsBits.ViewChannel],
},
], 'Needed to change permissions');
NameTypeOptionalDescription
overwritesreadonly OverwriteResolvable[] | ReadonlyCollection<Snowflake, OverwriteResolvable>NoPermission overwrites the channel gets updated with
reasonstringYesReason for updating the channel overwrites
valueOf():Collection<Key, Holds>