Skip to content

Commit

Permalink
[Fix] Fixed a missing default avatar icon for the pink icon
Browse files Browse the repository at this point in the history
- Added the 6th Default Avatar ID, which is only available to Migrated users
- Fixed `getDefaultAvatarId` for legacy users, and to more clearly represent discord documentation
  • Loading branch information
CDAGaming committed Jun 2, 2024
1 parent 44c7a09 commit fd66bda
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/main/java/com/jagrosh/discordipc/entities/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,13 @@ public String getAvatarUrl() {
* @return The Users {@link DefaultAvatar} avatar ID.
*/
public String getDefaultAvatarId() {
return DefaultAvatar.values()[(getDiscriminator().equals("0") ? (int) getIdLong() >> 22 : Integer.parseInt(getDiscriminator())) % DefaultAvatar.values().length].toString();
int index;
if (getDiscriminator().equals("0")) {
index = ((int) getIdLong() >> 22) % 6;
} else {
index = Integer.parseInt(getDiscriminator()) % 5;
}
return DefaultAvatar.values()[index].toString();
}

/**
Expand Down Expand Up @@ -205,7 +211,8 @@ public enum DefaultAvatar {
GREY("322c936a8c8be1b803cd94861bdfa868"),
GREEN("dd4dbc0016779df1378e7812eabaa04d"),
ORANGE("0e291f67c9274a1abdddeb3fd919cbaa"),
RED("1cbd08c76f8af6dddce02c5138971129");
RED("1cbd08c76f8af6dddce02c5138971129"),
PINK("1b3106e166c99cc64682");

private final String text;

Expand Down

0 comments on commit fd66bda

Please sign in to comment.