mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-18 04:23:31 +01:00
Make GuildMember.kickable/bannable take role IDs into account
This commit is contained in:
@@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user