mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13: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
|
||||
|
||||
1
typings/index.d.ts
vendored
1
typings/index.d.ts
vendored
@@ -632,6 +632,7 @@ declare module 'discord.js' {
|
||||
public parentID: Snowflake | null;
|
||||
public permissionOverwrites: Collection<Snowflake, PermissionOverwrites>;
|
||||
public position: number;
|
||||
public readonly permissionsLocked: boolean | null;
|
||||
public clone(name?: string, withPermissions?: boolean, withTopic?: boolean, reason?: string): Promise<GuildChannel>;
|
||||
public createInvite(options?: InviteOptions, reason?: string): Promise<Invite>;
|
||||
public delete(reason?: string): Promise<GuildChannel>;
|
||||
|
||||
Reference in New Issue
Block a user