mirror of
https://github.com/danbulant/discord.js
synced 2026-07-07 20:20:55 +00:00
Make GuildMember.kickable/bannable take role IDs into account
This commit is contained in:
parent
db815d4d9f
commit
d1e07674b8
1 changed files with 8 additions and 2 deletions
|
|
@ -204,7 +204,10 @@ class GuildMember {
|
||||||
if (this.user.id === this.client.user.id) return false;
|
if (this.user.id === this.client.user.id) return false;
|
||||||
const clientMember = this.guild.member(this.client.user);
|
const clientMember = this.guild.member(this.client.user);
|
||||||
if (!clientMember.hasPermission(Constants.PermissionFlags.KICK_MEMBERS)) return false;
|
if (!clientMember.hasPermission(Constants.PermissionFlags.KICK_MEMBERS)) return false;
|
||||||
return clientMember.highestRole.position > this.highestRole.position;
|
const clientRole = clientMember.highestRole;
|
||||||
|
const thisRole = this.highestRole;
|
||||||
|
return clientRole.position > thisRole.position ||
|
||||||
|
(clientRole.position === thisRole.position && clientRole.id < thisRole.position);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -217,7 +220,10 @@ class GuildMember {
|
||||||
if (this.user.id === this.client.user.id) return false;
|
if (this.user.id === this.client.user.id) return false;
|
||||||
const clientMember = this.guild.member(this.client.user);
|
const clientMember = this.guild.member(this.client.user);
|
||||||
if (!clientMember.hasPermission(Constants.PermissionFlags.BAN_MEMBERS)) return false;
|
if (!clientMember.hasPermission(Constants.PermissionFlags.BAN_MEMBERS)) return false;
|
||||||
return clientMember.highestRole.position > this.highestRole.position;
|
const clientRole = clientMember.highestRole;
|
||||||
|
const thisRole = this.highestRole;
|
||||||
|
return clientRole.position > thisRole.position ||
|
||||||
|
(clientRole.position === thisRole.position && clientRole.id < thisRole.position);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue