mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
fix(Permissions): Permissions itself is a valid PermissionResolvable
fixes #2753
This commit is contained in:
@@ -190,6 +190,7 @@ class Permissions {
|
||||
*/
|
||||
static resolve(permission) {
|
||||
if (permission instanceof Array) return permission.map(p => this.resolve(p)).reduce((prev, p) => prev | p, 0);
|
||||
if (permission instanceof Permissions) return permission.bitfield;
|
||||
if (typeof permission === 'string') permission = this.FLAGS[permission];
|
||||
if (typeof permission !== 'number' || permission < 0) throw new RangeError(Constants.Errors.NOT_A_PERMISSION);
|
||||
return permission;
|
||||
|
||||
Reference in New Issue
Block a user