From 299258b33bdd0c296f0cd3a84128b05b24208596 Mon Sep 17 00:00:00 2001 From: DTrombett Date: Fri, 24 Dec 2021 17:42:51 +0100 Subject: [PATCH 1/2] fix(Permissions): toArray shouldn't check admin --- src/util/Permissions.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/util/Permissions.js b/src/util/Permissions.js index 8646e1358032..c7a91340a937 100644 --- a/src/util/Permissions.js +++ b/src/util/Permissions.js @@ -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); + } } /** From 6e216d54c40fd3057f27ba6d81e36788f3d549cc Mon Sep 17 00:00:00 2001 From: DTrombett Date: Fri, 24 Dec 2021 18:05:27 +0100 Subject: [PATCH 2/2] types(Permissions): update toArray --- typings/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/typings/index.d.ts b/typings/index.d.ts index 0206ffd7dd7d..adffc72ca8e7 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -1851,7 +1851,7 @@ export class Permissions extends BitField { public has(permission: PermissionResolvable, checkAdmin?: boolean): boolean; public missing(bits: BitFieldResolvable, checkAdmin?: boolean): PermissionString[]; public serialize(checkAdmin?: boolean): Record; - public toArray(checkAdmin?: boolean): PermissionString[]; + public toArray(): PermissionString[]; public static ALL: bigint; public static DEFAULT: bigint;