mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-18 04:23:31 +01:00
Update Role#hasPermission, and deprecate hasPermissions
This commit is contained in:
@@ -145,8 +145,11 @@ class Role {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the role has a permission.
|
* 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
|
* @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}
|
* @returns {boolean}
|
||||||
* @example
|
* @example
|
||||||
* // see if a role can ban a member
|
* // see if a role can ban a member
|
||||||
@@ -156,8 +159,10 @@ class Role {
|
|||||||
* console.log('This role can\'t ban members');
|
* console.log('This role can\'t ban members');
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
hasPermission(permission, explicit) {
|
hasPermission(permission, explicit = false, checkAdmin) {
|
||||||
return new Permissions(this.permissions).has(permission, !explicit);
|
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 {PermissionResolvable[]} permissions The permissions to check for
|
||||||
* @param {boolean} [explicit=false] Whether to require the role to explicitly have the exact permissions
|
* @param {boolean} [explicit=false] Whether to require the role to explicitly have the exact permissions
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
hasPermissions(permissions, explicit = false) {
|
hasPermissions(permissions, explicit = false) {
|
||||||
return new Permissions(this.permissions).has(permissions, !explicit);
|
return new Permissions(this.permissions).has(permissions, !explicit);
|
||||||
|
|||||||
Reference in New Issue
Block a user