mirror of
https://github.com/danbulant/discord.js
synced 2026-06-20 15:11:32 +00:00
Update Role#hasPermission, and deprecate hasPermissions
This commit is contained in:
parent
df2333ac82
commit
3e5096f9fe
1 changed files with 9 additions and 3 deletions
|
|
@ -145,8 +145,11 @@ class Role {
|
|||
|
||||
/**
|
||||
* Checks if the role has a permission.
|
||||
* @param {PermissionResolvable} permission The permission to check for
|
||||
* @param {PermissionResolvable|PermissionResolvable[]} permission Permission(s) to check for
|
||||
* @param {boolean} [explicit=false] Whether to require the role to explicitly have the exact permission
|
||||
* **(deprecated)**
|
||||
* @param {boolean} [checkAdmin] Whether to allow the administrator permission to override
|
||||
* (takes priority over `explicit`)
|
||||
* @returns {boolean}
|
||||
* @example
|
||||
* // see if a role can ban a member
|
||||
|
|
@ -156,8 +159,10 @@ class Role {
|
|||
* console.log('This role can\'t ban members');
|
||||
* }
|
||||
*/
|
||||
hasPermission(permission, explicit) {
|
||||
return new Permissions(this.permissions).has(permission, !explicit);
|
||||
hasPermission(permission, explicit = false, checkAdmin) {
|
||||
return new Permissions(this.permissions).has(
|
||||
permission, typeof checkAdmin !== 'undefined' ? checkAdmin : !explicit
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -165,6 +170,7 @@ class Role {
|
|||
* @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}
|
||||
* @deprecated
|
||||
*/
|
||||
hasPermissions(permissions, explicit = false) {
|
||||
return new Permissions(this.permissions).has(permissions, !explicit);
|
||||
|
|
|
|||
Loading…
Reference in a new issue