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

# Variables

> All available variables that can be used in custom content.

<Tabs>
  <Tab title="User">
    | Variable                      | Output                                                                |
    | ----------------------------- | --------------------------------------------------------------------- |
    | `{user.mentions}`             | Comma separated mentions of all members                               |
    | `{user.display_names}`        | Comma separated display names of all members                          |
    | `{user.names}`                | Comma separated usernames of all members                              |
    | `{user.join_position}`        | Join position of the member in the server                             |
    | `{user.id}`                   | User ID                                                               |
    | `{user.name}`                 | Username without discriminator                                        |
    | `{user.display_name}`         | Server-specific nickname or username                                  |
    | `{user.mention}`              | User mention string                                                   |
    | `{user.avatar}`               | User's global avatar URL                                              |
    | `{user.server_avatar}`        | User's server-specific avatar URL                                     |
    | `{user.display_avatar}`       | The avatar displayed (server or global)                               |
    | `{user.created_at}`           | Account creation timestamp                                            |
    | `{user.created_at.relative}`  | Account creation timestamp in relative format                         |
    | `{user.created_at.timestamp}` | Account creation timestamp, only use this in embed timestamp          |
    | `{user.joined_at}`            | Join date of the user in the server                                   |
    | `{user.joined_at.relative}`   | Join date of the user in the server in relative format                |
    | `{user.joined_at.timestamp}`  | Join date of the user in the server, only use this in embed timestamp |
    | `{user.boosting}`             | Whether the user is boosting the server                               |
    | `{user.boost_since}`          | Time when user started boosting                                       |
    | `{user.bot}`                  | Whether the user is a bot                                             |
  </Tab>

  <Tab title="Guild">
    | Variable                       | Output                          |
    | ------------------------------ | ------------------------------- |
    | `{server.id}`                  | Server (guild) ID               |
    | `{server.name}`                | Server name                     |
    | `{server.description}`         | Server description              |
    | `{server.owner}`               | Server owner's username         |
    | `{server.owner_id}`            | Server owner's user ID          |
    | `{server.owner_mention}`       | Mention of the server owner     |
    | `{server.icon_url}`            | Server icon URL                 |
    | `{server.banner_url}`          | Server banner URL               |
    | `{server.member_count}`        | Number of members in the server |
    | `{server.channel_count}`       | Total number of channels        |
    | `{server.text_channel_count}`  | Number of text channels         |
    | `{server.voice_channel_count}` | Number of voice channels        |
    | `{server.category_count}`      | Number of channel categories    |
    | `{server.role_count}`          | Number of roles                 |
    | `{server.emoji_count}`         | Number of custom emojis         |
    | `{server.sticker_count}`       | Number of stickers              |
    | `{server.boost_count}`         | Number of server boosts         |
  </Tab>

  <Tab title="Channel">
    | Variable             | Output                                   |
    | -------------------- | ---------------------------------------- |
    | `{channel.id}`       | Channel ID                               |
    | `{channel.name}`     | Channel name                             |
    | `{channel.mention}`  | Channel mention                          |
    | `{channel.type}`     | Channel type (text, voice, thread, etc.) |
    | `{channel.category}` | Channel category name                    |
  </Tab>

  <Tab title="Role">
    | Variable         | Output       |
    | ---------------- | ------------ |
    | `{role.id}`      | Role ID      |
    | `{role.name}`    | Role name    |
    | `{role.mention}` | Role mention |
  </Tab>

  <Tab title="Giveaway">
    | Variable          | Output                                                                 |
    | ----------------- | ---------------------------------------------------------------------- |
    | `{gw.prize}`      | Giveaway prize                                                         |
    | `{gw.winners}`    | Number of winners                                                      |
    | `{gw.host}`       | Giveaway host mention                                                  |
    | `{gw.duration}`   | Giveaway end time as Unix timestamp                                    |
    | `{gw.timestamp}`  | Relative Discord timestamp (recommended)                               |
    | `{gw.claim_time}` | Winner claim time                                                      |
    | `{gw.reaction}`   | Giveaway reaction emoji                                                |
    | `{gw.entry_mode}` | Entry method (`click on` / `react with`)                               |
    | `{gw.preset}`     | All preset role information, used with for loops (see Scripting below) |
  </Tab>
</Tabs>

***

## Scripting

The scripting system lets you write dynamic content using **loops** and **inline conditions**. This is especially useful in giveaway messages where you want to display extra entries and claim times about a role from a [preset](/modules/giveaway/preset).

<Info>
  Scripting is currently mainly available in **giveaway** messages. The examples below will only work in giveaway contents.
</Info>

### Loop over preset roles

Use a `{% for %}` loop to iterate over every role in your giveaway's [preset](/modules/giveaway/preset) and display their entries and claim time.

```
{% for role in gw.preset %}
  {role.mention} has **{role.entries}** entries and **{role.claim_time}** claim time
{% endfor %}
```

`{% for role in gw.preset %}`: starts the loop; `role` becomes each preset role, one at a time\
`{role.mention}`: mentions the role\
`{role.entries}`: the number of extra entries that role has\
`{role.claim_time}`: the claim time for that role\
`{% endfor %}`: marks the end of the loop

**Example output:**

> @Active has **1** entries and **10 minutes** claim time\
> @Boosters has **2** entries and **15 minutes** claim time\
> @Supporters has **3** entries and **30 minutes** claim time

***

### Filter out a specific role

Use an **inline condition** to skip a role you don't want to display. When the condition matches, `pass` skips all remaining output for that role and moves on to the next role.

```
{% for role in gw.preset %}
  {role.id == 1403938022772314155; pass}
  {role.mention} has **{role.entries}** entries and **{role.claim_time}** claim time
{% endfor %}
```

`{role.id == 1403938022772314155; pass}`: <br />
If the role ID matches, it will be skipped entirely.
When the condition **doesn't** match, the line will be fully ignored and the loop will continue.

**Example output** (assuming the matched role is @Active):

> @Boosters has **2** entries and **15 minutes** claim time\
> @Supporters has **3** entries and **30 minutes** claim time

***

### Show a special message for one role

Use an **inline condition** to display a completely different message for a specific role. When the condition matches, the custom message is shown and the rest of the lines for that role are skipped automatically.

```
{% for role in gw.preset %}
  {role.id == 1403938022772314155; "{role.mention} are cool! **{role.entries}** entries"}
  {role.mention} has **{role.entries}** entries and **{role.claim_time}** claim time
{% endfor %}
```

`{role.id == 1403938022772314155; "..."}`:<br />
If the role ID matches, it will output the quoted string instead and skip the lines below it for that role.
For **all other** roles the condition doesn't trigger, so they fall through to the normal line.

**Example output** (assuming the matched role is @Supporters):

> @Active has **1** entries and **10 minutes** claim time\
> @Boosters has **2** entries and **15 minutes** claim time\
> @Supporters are cool! **3** entries

<Tip>
  You can use as many inline conditions as you want in the same loop to create complex filtering and output logic. Just remember that once a condition matches, the rest of the lines for that role are skipped, so order your conditions carefully.
</Tip>
