mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 00:23:30 +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[]}
|
||||
*/
|
||||
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 !== 'number' || permission < 1) throw new RangeError(Constants.Errors.NOT_A_PERMISSION);
|
||||
return permission;
|
||||
|
||||
Reference in New Issue
Block a user