Add GuildMember.hasPermissions

This commit is contained in:
Amish Shah
2016-09-11 12:58:51 +01:00
parent 3fba72107b
commit 9e05caec0d
2 changed files with 11 additions and 1 deletions

File diff suppressed because one or more lines are too long

View File

@@ -191,6 +191,16 @@ class GuildMember {
return this.roles.some(r => r.hasPermission(permission, explicit));
}
/**
* Checks whether the roles of the members allow them to perform specific actions.
* @param {Array<PermissionResolvable>} permissions the permissions to test for
* @param {boolean} [explicit=false] whether to require the member to explicitly have the exact permissions
* @returns {boolean}
*/
hasPermissions(permissions, explicit = false) {
return permissions.map(p => this.hasPermission(p, explicit)).every(v => v);
}
/**
* Mute/unmute a user
* @param {boolean} mute Whether or not the member should be muted