Mc2Discord

Mc2Discord

50.4k Downloads

`top_role` color is black when top role has no color.

SwanX1 opened this issue ยท 4 comments

commented

Describe the bug

On Discord the color of the member is the top role with a color. Mc2Discord uses the top role regardless of whether it has a color, and when it doesn't, it defaults to #000000

In-Game chat
Discord-linked chat

Swan#7488's top roles:
see above

IcyCrystal#0872's top role:
see above

Your config file

http://m2d.denisd3d.ml/uploads/view?key=5ddc14e0-dd0c-4dc0-ab39-1c27d2e3cd68

commented

Indeed this is an issue. Mc2Discord is using the discord library getHighestRole fonction so I may need to reimplement it to fix this.
I will try too fix this
Thanks for reporting

commented

Possible solution in code

PartialMember.java Line 140

- messageCreateEvent.getMember().get().getHighestRole()
+ MathFlux.max(messageCreateEvent.getMember().get().getRoles().filter(role -> role.getColor() != 0), OrderUtil.ROLE_ORDER)
 .map(Role::getColor).map(Color::getRGB).defaultIfEmpty(16777215).subscribe(integer -> {

No idea if this works, I wrote it looking at Discord4J's code and writing this straight in here.

commented

I've opened PR #68 that fixes this issue