mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-17 03:53:29 +01:00
Fix Permissions.resolve to return a combined bitfield for arrays
This commit is contained in:
@@ -151,7 +151,7 @@ class Permissions {
|
|||||||
* @returns {number|number[]}
|
* @returns {number|number[]}
|
||||||
*/
|
*/
|
||||||
static resolve(permission) {
|
static resolve(permission) {
|
||||||
if (permission instanceof Array) return permission.map(p => this.resolve(p));
|
if (permission instanceof Array) return permission.map(p => this.resolve(p)).reduce((prev, p) => prev | p, 0);
|
||||||
if (typeof permission === 'string') permission = this.FLAGS[permission];
|
if (typeof permission === 'string') permission = this.FLAGS[permission];
|
||||||
if (typeof permission !== 'number' || permission < 1) throw new RangeError(Constants.Errors.NOT_A_PERMISSION);
|
if (typeof permission !== 'number' || permission < 1) throw new RangeError(Constants.Errors.NOT_A_PERMISSION);
|
||||||
return permission;
|
return permission;
|
||||||
|
|||||||
Reference in New Issue
Block a user