Added .missingPermissions() (#756)

* Added .missingPermissions()

* Added .missingPermissions()

* Fixed docs for .missingPermissions()

* Fixed Travis CI trailing spaces?

* Fixed Travis CI trailing spaces?
This commit is contained in:
bdistin
2016-09-30 16:08:19 -05:00
committed by Amish Shah
parent b1322cbc69
commit 428ee2f718
2 changed files with 20 additions and 0 deletions

View File

@@ -52,6 +52,16 @@ class EvaluatedPermissions {
hasPermissions(permissions, explicit = false) {
return permissions.map(p => this.hasPermission(p, explicit)).every(v => v);
}
/**
* Checks whether the user has all specified permissions, and lists any missing permissions.
* @param {PermissionResolvable[]} permissions The permissions to check for
* @param {boolean} [explicit=false] Whether to require the user to explicitly have the exact permissions
* @returns {array}
*/
missingPermissions(permissions, explicit = false) {
return permissions.filter(p => !this.hasPermission(p, explicit));
}
}
module.exports = EvaluatedPermissions;

View File

@@ -253,6 +253,16 @@ class GuildMember {
return permissions.map(p => this.hasPermission(p, explicit)).every(v => v);
}
/**
* Checks whether the roles of the member allows them to perform specific actions, and lists any missing permissions.
* @param {PermissionResolvable[]} permissions The permissions to check for
* @param {boolean} [explicit=false] Whether to require the member to explicitly have the exact permissions
* @returns {array}
*/
missingPermissions(permissions, explicit = false) {
return permissions.filter(p => !this.hasPermission(p, explicit));
}
/**
* Edit a Guild Member
* @param {GuildmemberEditData} data The data to edit the member with