Skip to content
Entity Info userServerAvatar

$userServerAvatar

The $userServerAvatar function returns the URL of the server-specific avatar of a member, falling back to the global avatar.

Syntax

$userServerAvatar[userID]

Parameters

Parameter Description
userID Required. The ID of the user (digits only, greater than 0). Otherwise Invalid user ID. is raised.

$userServerAvatar without brackets, or with more than one argument, is refused (“Invalid argument count”).

Return Value

  • Type: String (URL)
  • The URL of the member’s server-specific avatar, or the global avatar of the user if the member has no server avatar.

Behavior

  • The user must be a member of the server, otherwise the error User is not a member of this guild. is raised.
  • If the member has no server-specific avatar, the global avatar of the user is returned (as $userAvatar[userID]).

Examples

Compare global and server avatars

$title[Avatars of $username]
$thumbnail[$userAvatar[$authorID]]
$image[$userServerAvatar[$authorID]]
$color[#5865F2]

Detect a custom server avatar

$if[$userServerAvatar[$authorID]!=$userAvatar[$authorID]]
  $sendMessage[You have a custom avatar for this server!]
$else
  $sendMessage[You are using your global avatar.]
$endif

Notes

  • Errors: Invalid user ID. and User is not a member of this guild.
  • $authorAvatar is the zero-argument equivalent for the global avatar of the author.

Try it

Paste an example into the playground to preview its message (functions that act on Discord are not run), or build the same thing with blocks.