mirror of
https://github.com/danbulant/discord.js
synced 2026-06-08 01:01:30 +00:00
Fix Permissions.resolve to return a combined bitfield for arrays
This commit is contained in:
parent
633e3ca896
commit
79278bccb4
1 changed files with 1 additions and 1 deletions
|
|
@ -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;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue