mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-13 10:03:31 +01:00
feat(GuildChannel): backport permissionsLocked getter (#3507)
* backport(GuildChannel): GuildChannel#permissionsLocked * typings: GuildChannel#permissionsLocked * fix(typings): mark permissionsLocked getter as readonly
This commit is contained in:
@@ -73,6 +73,22 @@ class GuildChannel extends Channel {
|
||||
return this.guild.channels.get(this.parentID) || null;
|
||||
}
|
||||
|
||||
/**
|
||||
* If the permissionOverwrites match the parent channel, null if no parent
|
||||
* @type {?boolean}
|
||||
* @readonly
|
||||
*/
|
||||
get permissionsLocked() {
|
||||
if (!this.parent) return null;
|
||||
if (this.permissionOverwrites.size !== this.parent.permissionOverwrites.size) return false;
|
||||
return this.permissionOverwrites.every((value, key) => {
|
||||
const testVal = this.parent.permissionOverwrites.get(key);
|
||||
return testVal !== undefined &&
|
||||
testVal.deny === value.deny &&
|
||||
testVal.allow === value.allow;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the overall set of permissions for a user in this channel, taking into account channel overwrites.
|
||||
* @param {GuildMemberResolvable} member The user that you want to obtain the overall permissions for
|
||||
|
||||
Reference in New Issue
Block a user