mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-16 03:23:29 +01:00
Add <Role>.manageable (#878)
This commit is contained in:
@@ -285,6 +285,18 @@ class Role {
|
|||||||
return this.client.rest.methods.deleteGuildRole(this);
|
return this.client.rest.methods.deleteGuildRole(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether the role is managable by the client user.
|
||||||
|
* @type {boolean}
|
||||||
|
* @readonly
|
||||||
|
*/
|
||||||
|
get manageable() {
|
||||||
|
if (this.managed) return false;
|
||||||
|
const clientMember = this.guild.member(this.client.user);
|
||||||
|
if (!clientMember.hasPermission(Constants.PermissionFlags.MANAGE_ROLES_OR_PERMISSIONS)) return false;
|
||||||
|
return clientMember.highestRole.comparePositionTo(this) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether this role equals another role. It compares all properties, so for most operations
|
* Whether this role equals another role. It compares all properties, so for most operations
|
||||||
* it is advisable to just compare `role.id === role2.id` as it is much faster and is often
|
* it is advisable to just compare `role.id === role2.id` as it is much faster and is often
|
||||||
|
|||||||
Reference in New Issue
Block a user