mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
Compensate for API's stupid-ass positions in highestRole (#721)
* fix edge cases of highestRole not returning the highest role * fix line length * move space * Fix formatting
This commit is contained in:
committed by
Schuyler Cebulskie
parent
46c28c0d05
commit
126865384e
@@ -119,7 +119,9 @@ class GuildMember {
|
||||
* @type {Role}
|
||||
*/
|
||||
get highestRole() {
|
||||
return this.roles.reduce((prev, role) => !prev || role.position > prev.position ? role : prev);
|
||||
return this.roles.reduce((prev, role) =>
|
||||
!prev || role.position > prev.position || (role.position === prev.position && role.id < prev.id) ? role : prev
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user