Skip to content

Commit

Permalink
refactor: rename AvatarIndex to DefaultAvatarIndex
Browse files Browse the repository at this point in the history
  • Loading branch information
FedorLap2006 committed Jul 3, 2023
1 parent a66e62c commit d38ce10
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions user.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func (u *User) Mention() string {
func (u *User) AvatarURL(size string) string {
return avatarURL(
u.Avatar,
EndpointDefaultUserAvatar(u.AvatarIndex()),
EndpointDefaultUserAvatar(u.DefaultAvatarIndex()),
EndpointUserAvatar(u.ID, u.Avatar),
EndpointUserAvatarAnimated(u.ID, u.Avatar),
size,
Expand All @@ -134,8 +134,8 @@ func (u *User) isMigrated() bool {
return u.Discriminator == "" || u.Discriminator == "0"
}

// AvatarIndex returns the index of the user's avatar
func (u *User) AvatarIndex() uint64 {
// DefaultAvatarIndex returns the index of the user's default avatar.
func (u *User) DefaultAvatarIndex() uint64 {
if u.isMigrated() {
id, _ := strconv.ParseUint(u.ID, 10, 64)
return (id >> 22) % 6
Expand Down

0 comments on commit d38ce10

Please sign in to comment.