mirror of
https://github.com/danbulant/discord.js
synced 2026-06-08 01:01:30 +00:00
Add Role.hasPermissions
This commit is contained in:
parent
46b7628d59
commit
38c85dc076
2 changed files with 11 additions and 1 deletions
File diff suppressed because one or more lines are too long
|
|
@ -119,6 +119,16 @@ class Role {
|
||||||
return (this.permissions & permission) > 0;
|
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
|
* Edits the role
|
||||||
* @param {RoleData} data The new data for the role
|
* @param {RoleData} data The new data for the role
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue