Nostrum.Struct.User.avatar_url

You're seeing just the function avatar_url, go back to Nostrum.Struct.User module for more information.
Link to this function

avatar_url(user, image_format \\ "webp")

View Source

Specs

avatar_url(t(), String.t()) :: String.t()

Returns the URL of a user's display avatar.

If :avatar is nil, the default avatar url is returned.

Supported image formats are PNG, JPEG, WebP, and GIF.

Examples

iex> user = %Nostrum.Struct.User{avatar: "8342729096ea3675442027381ff50dfe",
...>                             id: 80351110224678912}
iex> Nostrum.Struct.User.avatar_url(user)
"https://cdn.discordapp.com/avatars/80351110224678912/8342729096ea3675442027381ff50dfe.webp"
iex> Nostrum.Struct.User.avatar_url(user, "png")
"https://cdn.discordapp.com/avatars/80351110224678912/8342729096ea3675442027381ff50dfe.png"

iex> user = %Nostrum.Struct.User{avatar: nil,
...>                             discriminator: "1337"}
iex> Nostrum.Struct.User.avatar_url(user)
"https://cdn.discordapp.com/embed/avatars/2.png"