mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
Add Role.hasPermissions
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user