mirror of
https://github.com/danbulant/discord.js
synced 2026-05-24 20:42:27 +00:00
Add <Role>.manageable (#878)
This commit is contained in:
parent
5dc30d6812
commit
7d02e73a26
1 changed files with 12 additions and 0 deletions
|
|
@ -284,6 +284,18 @@ class Role {
|
|||
delete() {
|
||||
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
|
||||
|
|
|
|||
Loading…
Reference in a new issue