mirror of
https://github.com/danbulant/discord.js
synced 2026-06-08 09:13:22 +00:00
fix(Permissions): Permissions itself is a valid PermissionResolvable
fixes #2753
This commit is contained in:
parent
616e0dd398
commit
5d889be6db
1 changed files with 1 additions and 0 deletions
|
|
@ -190,6 +190,7 @@ class Permissions {
|
||||||
*/
|
*/
|
||||||
static resolve(permission) {
|
static resolve(permission) {
|
||||||
if (permission instanceof Array) return permission.map(p => this.resolve(p)).reduce((prev, p) => prev | p, 0);
|
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 === 'string') permission = this.FLAGS[permission];
|
||||||
if (typeof permission !== 'number' || permission < 0) throw new RangeError(Constants.Errors.NOT_A_PERMISSION);
|
if (typeof permission !== 'number' || permission < 0) throw new RangeError(Constants.Errors.NOT_A_PERMISSION);
|
||||||
return permission;
|
return permission;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue