Add Role.hasPermissions

This commit is contained in:
Schuyler Cebulskie
2016-09-12 00:06:21 -04:00
parent 46b7628d59
commit 38c85dc076
2 changed files with 11 additions and 1 deletions

File diff suppressed because one or more lines are too long

View File

@@ -119,6 +119,16 @@ class Role {
return (this.permissions & permission) > 0;
}
/**
* Checks if the role has all specified permissions.
* @param {PermissionResolvable[]} permissions The permissions to check for
* @param {boolean} [explicit=false] Whether to require the role to explicitly have the exact permissions
* @returns {boolean}
*/
hasPermissions(permissions, explicit = false) {
return permissions.map(p => this.hasPermission(p, explicit)).every(v => v);
}
/**
* Edits the role
* @param {RoleData} data The new data for the role