assign discord avatar only if exist

This commit is contained in:
Gani Georgiev
2026-03-30 08:15:26 +03:00
parent a2b14bcb93
commit 2dbc70d60d

View File

@@ -67,7 +67,10 @@ func (p *Discord) FetchAuthUser(token *oauth2.Token) (*AuthUser, error) {
// build a full avatar URL using the avatar hash provided in the API response
// https://discord.com/developers/docs/reference#image-formatting
avatarURL := fmt.Sprintf("https://cdn.discordapp.com/avatars/%s/%s.png", extracted.Id, extracted.Avatar)
var avatarURL string
if extracted.Avatar != "" {
avatarURL = fmt.Sprintf("https://cdn.discordapp.com/avatars/%s/%s.png", extracted.Id, extracted.Avatar)
}
name := extracted.GlobalName
if name == "" {