> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mira.party/llms.txt
> Use this file to discover all available pages before exploring further.

# Variables

> Placeholders that get replaced with real values when a script is rendered.

A variable is `{object.property}`. When the script runs, it's swapped for the real value.

```javascript theme={null}
{description: {user.mention} joined — that's {guild.members} members now.}
```

Which variables exist depends on **where** the script runs. A welcome message knows about the member who joined; a ticket message knows about the ticket. The common ones below are available almost everywhere.

<Info>
  If a variable doesn't exist in the current context, it's left in the output as literal text. Seeing `{user.rank}` in your message means that variable isn't available there — not that it's spelled wrong.
</Info>

## Member

`{user}` on its own renders as a mention.

| Variable                    | Result                                   |
| --------------------------- | ---------------------------------------- |
| `{user}` / `{user.mention}` | `@someone`                               |
| `{user.name}`               | `someone`                                |
| `{user.display_name}`       | Their nickname, or username if unset     |
| `{user.global_name}`        | Their display name                       |
| `{user.id}`                 | `1234567890`                             |
| `{user.avatar}`             | URL to their avatar                      |
| `{user.created_at}`         | Account creation, as a Discord timestamp |
| `{user.joined_at}`          | When they joined this server             |
| `{user.join_position}`      | `47` — the Nth member to join            |
| `{user.top_role}`           | Their highest role                       |
| `{user.roles}`              | Comma-separated role names               |
| `{user.role_ids}`           | Comma-separated role IDs                 |
| `{user.color}`              | Their role colour                        |
| `{user.bot}`                | `True` / `False`                         |

<Tip>
  `user`, `member`, `author`, `u` and `m` are interchangeable. `{member.name}` and `{u.name}` are the same as `{user.name}` — use whichever reads better to you.
</Tip>

## Server

| Variable             | Result                         |
| -------------------- | ------------------------------ |
| `{guild.name}`       | Your server's name             |
| `{guild.id}`         | Its ID                         |
| `{guild.icon}`       | URL to the icon                |
| `{guild.members}`    | Total member count             |
| `{guild.humans}`     | Non-bot members                |
| `{guild.bots}`       | Bot members                    |
| `{guild.boosters}`   | Number of boosters             |
| `{guild.boosts}`     | Boost count                    |
| `{guild.boost_tier}` | `0`–`3`                        |
| `{guild.vanity}`     | Vanity code, e.g. `mira`       |
| `{guild.vanity_url}` | The full `discord.gg/...` link |
| `{guild.created_at}` | When the server was made       |
| `{guild.owner}`      | The owner                      |

Aliases: `guild`, `server`, `sv`, `g`, `s`. `{server.name}` works.

## Channel

| Variable                          | Result            |
| --------------------------------- | ----------------- |
| `{channel}` / `{channel.mention}` | `#general`        |
| `{channel.name}`                  | `general`         |
| `{channel.id}`                    | Its ID            |
| `{channel.topic}`                 | The channel topic |

Aliases: `channel`, `ch`, `c`.

## Context-specific variables

<AccordionGroup>
  <Accordion title="Levels" icon="chart-line">
    Available in `!level message`:

    | Variable             | Result                       |
    | -------------------- | ---------------------------- |
    | `{user.level}`       | The level just reached       |
    | `{user.next_level}`  | The one after it             |
    | `{user.xp}`          | XP toward the current level  |
    | `{user.total_xp}`    | Lifetime XP                  |
    | `{user.required_xp}` | XP needed for the next level |

    ```javascript theme={null}
    !level message {content: gg {user.mention}} {description: level **{user.level}** — {user.required_xp} xp to {user.next_level}} {color: dominant}
    ```
  </Accordion>

  <Accordion title="Moderation" icon="gavel">
    Available in `!invoke` responses, which override what moderation commands reply with:

    | Variable      | Result                    |
    | ------------- | ------------------------- |
    | `{user}`      | The member being punished |
    | `{moderator}` | Who ran the command       |
    | `{reason}`    | The reason given          |
    | `{case}`      | The case number           |
    | `{duration}`  | For temp punishments      |

    ```javascript theme={null}
    !invoke ban {content: {user.name} got hit — case #{case}} {description: {reason}}
    ```

    `!invoke variables` lists them in Discord.
  </Accordion>

  <Accordion title="Tickets" icon="ticket">
    Available in ticket option messages:

    `{case}`, `{panel}`, `{option}`, `{creator}`, `{claimer}`, `{reason}`, plus `{user}` for whoever triggered the action.

    ```javascript theme={null}
    !tickets option message Support billing greeting {title: Ticket #{case}} {description: hey {creator.mention} — someone will be with you shortly.}
    ```
  </Accordion>

  <Accordion title="Vanity and tag roles" icon="link">
    In `!vanity message` and `!tag message`, `{user}` is the member who was awarded a role and `{role}` is the role they got.
  </Accordion>

  <Accordion title="Counter channels" icon="hashtag">
    Counter channel names use a **different, flatter** variable set — no `user.` or `guild.` prefix. `{members}`, `{boosters}`, `{online}`, `{messages_today}`, `{voice_week}` and so on. See [Counters](/setup/counters#variables) for the full list, or run `!counter variables`.
  </Accordion>

  <Accordion title="VoiceMaster" icon="microphone">
    `!voicemaster default name` accepts `{user.name}`, and defaults to something like `{user.name}'s channel`.
  </Accordion>
</AccordionGroup>

## Timestamps

Any date variable renders as a raw Unix timestamp, which means you can drop it straight into Discord's timestamp markdown:

```javascript theme={null}
{description: account made <t:{user.created_at}:R>}
```

Renders as *account made 3 years ago*. The format letters are Discord's own:

| Suffix | Output                          |
| ------ | ------------------------------- |
| `:R`   | `3 years ago`                   |
| `:d`   | `20/04/2021`                    |
| `:D`   | `April 20, 2021`                |
| `:t`   | `16:20`                         |
| `:F`   | `Tuesday, April 20, 2021 16:20` |

Add `.iso` to get an ISO 8601 string instead — `{user.created_at.iso}`.

## Finding what's available

Most modules have a `variables` subcommand that lists exactly what that context supports:

```javascript theme={null}
!welcome variables
!goodbye variables
!boost variables
!rejoin variables
!pingonjoin variables
!invoke variables
!counter variables
!autothread variables
```

<Tip>
  Variables compose with [operators](/scripting/operators). `{guild.members|comma}` gives `1,247`, `{user.name|upper}` shouts, and `{if: {user.bot}==True && beep boop && welcome}` branches on a value.
</Tip>
