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

# Scripting Examples: From Simple to Branded Cards

> Ready-to-use haze script templates — plain variable welcome messages, branded ticket cards, avatars, per-button billing scripts, and preview commands.

The fastest way to learn haze scripting is to read working templates and adapt them. The examples below progress from a plain text welcome message that only uses variables, through fully branded cards with colors and media, to per-button scripts with action buttons and links. Copy any example, swap in your own text and URLs, then preview it before saving.

## 1. Simple Welcome (Variables Only)

No layout tags — this template stays in variables-only mode and outputs interpolated plain text.

```text theme={null}
Hey {user.mention} — thanks for opening a ticket in **{guild.name}**.
A staff member will be with you soon.
```

## 2. Branded Open Card

Adds a haze accent color, a heading, body text, a visual separator, and a link button.

```text theme={null}
{color: haze}
{title: Ticket opened}
{text: Welcome {user.mention}!}
{text: Drop details below. Ticket id `{ticket}`.}
{separator}
{link: Website && https://haze.rest}
```

## 3. Support Card with Thumbnail and Avatar

Uses the opener's avatar as a section thumbnail. The `{user.avatar}` variable resolves to a direct image URL that `{thumbnail: …}` accepts.

```text theme={null}
{color: #57F287}
{title: You're in}
{thumbnail: {user.avatar}}
{text: Hi **{user.display_name}** — describe the issue and attach screenshots if you can.}
{footer: Staff typically replies within a few minutes}
```

## 4. Billing Button Script (Per-Button Welcome)

Set a per-button welcome so the billing ticket button shows a different card from your default. First, list your buttons to get the real IDs:

```bash theme={null}
,ticket button list
```

The output shows each button's label and ID:

```text theme={null}
Open ticket · `k9x2mPq1`
```

Then set the welcome by button ID or label, followed immediately by the script template:

```bash theme={null}
,ticket button welcome "Open ticket" {color: #FEE75C}
{title: Billing}
{text: Include your payment id and the email on the receipt.}
{text: Opener: {user.mention} ({user.id})}
{separator}
{button: close && Close && danger}
{link: Billing portal && https://haze.rest}
```

<Warning>
  Do **not** write `haze:ticket:close` as a button custom ID. Discord converts `:ticket:` into the 🎫 emoji at the API level, so your ID becomes `haze🎫close` and the button will never fire correctly. Use `close` or `haze.tickets.close` instead.
</Warning>

## 5. Preview Before Saving

Always preview a script in Discord before attaching it to a ticket button or welcome setting. Pass the template directly to `,script preview`:

```bash theme={null}
,script preview {title: Test} {text: Hello {user.display_name} from {guild.name}}
```

The bot renders the full card in the current channel with your real user and guild data, so you can confirm layout, colors, and variable output before anything goes live.

## Channel Name and Topic Templates

These settings use variables-only mode — no layout tags, just plain text with placeholders. Because there are no `{name: value}` tags, haze returns a simple interpolated string rather than building a card.

Set the ticket channel name:

```bash theme={null}
,ticket name help-{user}
```

Set the ticket channel topic:

```bash theme={null}
,ticket topic Opened by {user.display_name} · {user.id}
```
