# $authorIcon[]

The `$authorIcon[]` function **modifies only the icon** of the author of an embed after it has been set with `$author[]`. It avoids repeating the name and the URL when only the image needs to change.

## Syntax

```
$authorIcon[url;(embedIndex)]
```

## Parameters

| Parameter | Description |
|---|---|
| `url` | URL of the image to use as the author's icon. |
| `embedIndex` | Optional. Index of the targeted embed, from 1 to 10 (1 by default, also when empty). Any other value is an error. |

## Return value

Modifies the response in progress. Returns nothing.

## When to use $authorIcon[]

- You have already set the author with `$author[name]` and want to add or change the icon without modifying the name.
- The icon depends on a dynamic variable (avatar, role, etc.).
- You want a modular and readable structure.

## Examples

### Adding the user's avatar as an icon

```bdfd
$author[$username]
$authorIcon[$authorAvatar]
$title[Profile of $username]
$description[
**ID:** $authorID
**Account created on:** $creationDate[$authorID]
]
$color[#5865F2]
```

### Different icon based on role

```bdfd
$author[Moderation Message]
$if[$hasRole[$authorID;$roleID[Admin]]]
$authorIcon[https://cdn.example.com/admin-badge.png]
$elseif[$hasRole[$authorID;$roleID[Modo]]]
$authorIcon[https://cdn.example.com/modo-badge.png]
$else
$authorIcon[$authorAvatar]
$endif
$title[Warning]
$description[Please respect the server rules.]
$color[#ED4245]
```

## Notes

- The icon is only sent when the same embed also has an author **name** (`$author[]`). The order of the two calls does not matter, but an icon without a name is dropped.
- The URL must point to a publicly accessible image (PNG, JPG, GIF, WebP).
- To change the name or add a link, use `$author[]` (which redefines everything) or `$authorURL[]` respectively.
