mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-15 19:13:31 +01:00
fix(GuildMember): properly check permissions for hasPermissions (#4677)
This commit is contained in:
@@ -269,7 +269,8 @@ class GuildMember extends Base {
|
|||||||
*/
|
*/
|
||||||
hasPermission(permission, { checkAdmin = true, checkOwner = true } = {}) {
|
hasPermission(permission, { checkAdmin = true, checkOwner = true } = {}) {
|
||||||
if (checkOwner && this.user.id === this.guild.ownerID) return 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user