mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
fix(Permissions): toArray shouldn't check admin (#7144)
This commit is contained in:
@@ -31,7 +31,7 @@ class Permissions extends BitField {
|
||||
* @returns {string[]}
|
||||
*/
|
||||
missing(bits, checkAdmin = true) {
|
||||
return checkAdmin && this.has(this.constructor.FLAGS.ADMINISTRATOR) ? [] : super.missing(bits, checkAdmin);
|
||||
return checkAdmin && this.has(this.constructor.FLAGS.ADMINISTRATOR) ? [] : super.missing(bits);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -53,6 +53,14 @@ class Permissions extends BitField {
|
||||
has(permission, checkAdmin = true) {
|
||||
return (checkAdmin && super.has(this.constructor.FLAGS.ADMINISTRATOR)) || super.has(permission);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an {@link Array} of bitfield names based on the permissions available.
|
||||
* @returns {string[]}
|
||||
*/
|
||||
toArray() {
|
||||
return super.toArray(false);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
2
typings/index.d.ts
vendored
2
typings/index.d.ts
vendored
@@ -1851,7 +1851,7 @@ export class Permissions extends BitField<PermissionString, bigint> {
|
||||
public has(permission: PermissionResolvable, checkAdmin?: boolean): boolean;
|
||||
public missing(bits: BitFieldResolvable<PermissionString, bigint>, checkAdmin?: boolean): PermissionString[];
|
||||
public serialize(checkAdmin?: boolean): Record<PermissionString, boolean>;
|
||||
public toArray(checkAdmin?: boolean): PermissionString[];
|
||||
public toArray(): PermissionString[];
|
||||
|
||||
public static ALL: bigint;
|
||||
public static DEFAULT: bigint;
|
||||
|
||||
Reference in New Issue
Block a user