mirror of
https://github.com/danbulant/discord.js
synced 2026-06-18 14:11:09 +00:00
fix(GuildMember): properly check permissions for hasPermissions (#4677)
This commit is contained in:
parent
6261dd65d3
commit
7db6978012
1 changed files with 2 additions and 1 deletions
|
|
@ -269,7 +269,8 @@ class GuildMember extends Base {
|
|||
*/
|
||||
hasPermission(permission, { checkAdmin = true, checkOwner = true } = {}) {
|
||||
if (checkOwner && this.user.id === this.guild.ownerID) return true;
|
||||
return this.roles.cache.some(r => r.permissions.has(permission, checkAdmin));
|
||||
const permissions = new Permissions(this.roles.cache.map(role => role.permissions));
|
||||
return permissions.has(permission, checkAdmin);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue