> For the complete documentation index, see [llms.txt](https://docs.asagi.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.asagi.xyz/help-and-reference/variables.md).

# Variables

Variables let Asagi insert context-specific values into messages and names when a feature runs.

A variable is written inside double curly brackets:

```
{{user.username}}
```

For example:

```
Welcome, {{user.mention}}!
```

When the message is sent for a member, Asagi replaces the variable with that member's value.

### Where Variables Work

Available variables depend on the feature that sends the content.

| Feature                       | Available variable groups                        |
| ----------------------------- | ------------------------------------------------ |
| Greetings & Farewells         | User, Member, Server, Timestamp, Color           |
| Reminders                     | User, Member, Server, Timestamp, Color           |
| Auto Moderation notifications | User, Member, Server, Timestamp, Color           |
| Birthdays                     | User, Member, Server, Birthday, Timestamp, Color |
| Interactive Messages          | User, Member, Server, Roles, Timestamp, Color    |
| Private Room names            | User, Member, Server                             |
| Love Room names               | User 1, User 2, Member 1, Member 2, Server       |
| Starboard thread messages     | Server, Color                                    |

Reaction Roles messages do not have runtime member variables.

A saved **Embed Message** template can contain variables, but variables only resolve when the feature using that template provides the required context. Publishing a template manually from Embed Messages does not create a member or event context by itself.

### User Variables

| Variable               | Value                                    |
| ---------------------- | ---------------------------------------- |
| `{{user.id}}`          | Discord user ID                          |
| `{{user.username}}`    | Username                                 |
| `{{user.globalName}}`  | Global display name                      |
| `{{user.mention}}`     | User mention                             |
| `{{user.avatarUrl}}`   | User avatar URL                          |
| `{{user.bannerColor}}` | User profile accent color when available |

Love Rooms provide the same values as `user1.*` and `user2.*` for the two members.

### Member Variables

Member variables contain server-specific information.

| Variable                        | Value                              |
| ------------------------------- | ---------------------------------- |
| `{{member.nickname}}`           | Server nickname, when set          |
| `{{member.displayName}}`        | Display name on the server         |
| `{{member.serverAvatarUrl}}`    | Server-specific/display avatar URL |
| `{{member.roles.highest.name}}` | Name of the member's highest role  |

Love Rooms provide equivalent `member1.*` and `member2.*` variables.

### Server Variables

| Variable                | Value                            |
| ----------------------- | -------------------------------- |
| `{{guild.id}}`          | Server ID                        |
| `{{guild.name}}`        | Server name                      |
| `{{guild.iconUrl}}`     | Server icon URL                  |
| `{{guild.bannerUrl}}`   | Server banner URL when available |
| `{{guild.memberCount}}` | Current member count             |
| `{{guild.nameAcronym}}` | Server name acronym              |
| `{{guild.boostsCount}}` | Current server boost count       |

### Birthday Variables

Birthday variables are available in Birthday messages and related Birthday delivery content.

| Variable                   | Value                                |
| -------------------------- | ------------------------------------ |
| `{{birthday.date}}`        | Formatted birthday date              |
| `{{birthday.day}}`         | Day of the month                     |
| `{{birthday.month}}`       | Month name                           |
| `{{birthday.monthNumber}}` | Month number                         |
| `{{birthday.timestamp}}`   | Unix timestamp for the birthday date |

For example:

```
<t:{{birthday.timestamp}}:D>
```

### Role Variables

Interactive Messages can expose the roles changed by an interaction.

| Variable            | Value                            |
| ------------------- | -------------------------------- |
| `{{roles.added}}`   | Roles added by the interaction   |
| `{{roles.removed}}` | Roles removed by the interaction |

The value is formatted as Discord role mentions when roles are available.

### Timestamp Variables

Timestamp variables return Unix timestamps in seconds and are designed to work with Discord's `<t:...>` syntax.

| Variable                       | Value                                       |
| ------------------------------ | ------------------------------------------- |
| `{{timestamp.now}}`            | Current time                                |
| `{{timestamp.userCreatedAt}}`  | When the user's Discord account was created |
| `{{timestamp.memberJoinedAt}}` | When the member joined the server           |
| `{{timestamp.guildCreatedAt}}` | When the server was created                 |

Example:

```
Joined: <t:{{timestamp.memberJoinedAt}}:R>
```

### Color Variables

| Variable            | Value                               |
| ------------------- | ----------------------------------- |
| `{{color.default}}` | Asagi's default color               |
| `{{color.embed}}`   | The server's configured embed color |
| `{{color.error}}`   | Asagi's error color                 |

Color variables are most useful in fields that accept an embed color value.

### Fallback Values

Some information may not exist. A member may not have a nickname, for example.

Use a fallback string when you want a custom value instead:

```
{{member.nickname || "No nickname"}}
```

Asagi also accepts the single-pipe fallback form:

```
{{member.nickname | "No nickname"}}
```

Without a custom fallback, a missing supported variable resolves to `-`.

Fallback text can contain another supported variable:

```
{{member.nickname || "{{user.username}}"}}
```

### Conditional Text

Use a conditional expression when text should change depending on whether a value exists:

```
{{member.nickname ? "Has a nickname" : "No nickname"}}
```

The condition checks whether the variable has a value.

Conditional branches can also include supported variables:

```
{{member.nickname ? "Welcome, {{member.nickname}}!" : "Welcome, {{user.username}}!"}}
```

### Previewing Variables

In editors that know the runtime context, Asagi can preview supported variables using example or resolved values.

A variable can be valid in one feature and unsupported in another. If the editor marks a variable as unsupported, use a variable from one of the groups available to that feature instead.

### Where to Go Next

See **Permissions & Limits** for the permissions Asagi needs and the current Free and Premium quotas.
