add GuildMember#displayColour#321
add GuildMember#displayColour#321Stitch07 wants to merge 5 commits intodirigeants:masterfrom Stitch07:master
Conversation
| if (!highestRole || role.position < highestRole.position) continue; | ||
| if (role.color) highestRole = role; | ||
| } | ||
| return highestRole ? highestRole.color : 0; |
There was a problem hiding this comment.
this should return the hexadecimal
| return highestRole ? highestRole.color : 0; | |
| return highestRole ? highestRole.color : 0x000000; |
| public get displayColor(): number { | ||
| let highestRole = null; | ||
| for (const role of this.roles.values()) { | ||
| if (!highestRole || role.position < highestRole.position) continue; |
There was a problem hiding this comment.
Am I misreading this or is this totally bugged? Above it is defined as null then in every iteration this is just going to simply skip the loop. It's null so if (!null ) will always pass and continue to next loop meaning it will never really get the color
There was a problem hiding this comment.
Second bug on this is that it does not take into account when the role positions are equal. Yes that is possible
There was a problem hiding this comment.
May I ask when can role positions be equal?
There was a problem hiding this comment.
|
@Skillz4Killz pushed fixes. |
| } | ||
| highestRole = role; | ||
| } | ||
| return highestRole ? highestRole.color : 0; |
There was a problem hiding this comment.
| return highestRole ? highestRole.color : 0; | |
| return highestRole?.color || 0; |
| * The displayed colour of the member. | ||
| * @since 0.0.4 | ||
| */ | ||
| public get displayColour(): number { |
There was a problem hiding this comment.
| public get displayColour(): number { | |
| public get displayColor(): number { |
There was a problem hiding this comment.
This is actually more consistent with the rest of the lib. For example, highestRole.color as opposed to highestRole.colour
| } | ||
|
|
||
| /** | ||
| * The displayed colour of the member. |
There was a problem hiding this comment.
| * The displayed colour of the member. | |
| * The displayed color of the member. |
Adds a
displayColourproperty to GuildMember