mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-16 11:33:30 +01:00
backport: Permissions#toArray
This commit is contained in:
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user