mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
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:
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user