mirror of
https://github.com/danbulant/discord.js
synced 2026-06-07 16:52:16 +00:00
backport: Permissions#toArray
This commit is contained in:
parent
1e5b5b83c8
commit
6da423fc07
1 changed files with 9 additions and 0 deletions
|
|
@ -155,6 +155,15 @@ class Permissions {
|
||||||
return this.missing(permissions, !explicit);
|
return this.missing(permissions, !explicit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets an {@link Array} of permission names (such as `VIEW_CHANNEL`) based on the permissions available.
|
||||||
|
* @param {boolean} [checkAdmin=true] Whether to allow the administrator permission to override
|
||||||
|
* @returns {string[]}
|
||||||
|
*/
|
||||||
|
toArray(checkAdmin = true) {
|
||||||
|
return Object.keys(this.constructor.FLAGS).filter(perm => this.has(perm, checkAdmin));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Freezes these permissions, making them immutable.
|
* Freezes these permissions, making them immutable.
|
||||||
* @returns {Permissions} These permissions
|
* @returns {Permissions} These permissions
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue