mirror of
https://github.com/danbulant/discord.js
synced 2026-06-09 17:52:55 +00:00
fix(GuildMember#hasPermission): pass correct parameters to Permissions#has (#2070)
Also removed deprecated parameter of the method itself.
This commit is contained in:
parent
0a05761b49
commit
cd3d3344e8
1 changed files with 4 additions and 10 deletions
|
|
@ -294,19 +294,13 @@ class GuildMember extends Base {
|
||||||
/**
|
/**
|
||||||
* Checks if any of the member's roles have a permission.
|
* Checks if any of the member's roles have a permission.
|
||||||
* @param {PermissionResolvable|PermissionResolvable[]} permission Permission(s) 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} [checkAdmin=true] Whether to allow the administrator permission to override
|
||||||
* **(deprecated)**
|
* @param {boolean} [checkOwner=true] Whether to allow being the guild's owner to override
|
||||||
* @param {boolean} [checkAdmin] Whether to allow the administrator permission to override
|
|
||||||
* (takes priority over `explicit`)
|
|
||||||
* @param {boolean} [checkOwner] Whether to allow being the guild's owner to override
|
|
||||||
* (takes priority over `explicit`)
|
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
hasPermission(permission, explicit = false, checkAdmin, checkOwner) {
|
hasPermission(permission, checkAdmin = true, checkOwner = true) {
|
||||||
if (typeof checkAdmin === 'undefined') checkAdmin = !explicit;
|
|
||||||
if (typeof checkOwner === 'undefined') checkOwner = !explicit;
|
|
||||||
if (checkOwner && this.user.id === this.guild.ownerID) return true;
|
if (checkOwner && this.user.id === this.guild.ownerID) return true;
|
||||||
return this.roles.some(r => r.permissions.has(permission, undefined, checkAdmin));
|
return this.roles.some(r => r.permissions.has(permission, checkAdmin));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue