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

# Scripting

> Build custom embeds with confine's scripting syntax.

## How it works

An embed script is a series of parameters. Each one is wrapped in braces, uses a colon to separate the name from its content, and is joined to the next one with `$v`.

| Symbol | Purpose                                    |
| ------ | ------------------------------------------ |
| `{`    | Opens a parameter                          |
| `:`    | Splits the parameter name from its content |
| `$v`   | Separates one parameter from the next      |
| `}`    | Closes a parameter                         |

<Warning>
  Anywhere a command accepts both plain text and embed code, your script has to begin with `{embed}` — otherwise confine treats the whole thing as plain text.
</Warning>

```javascript theme={null}
,welcome add #general {embed}$v{title: welcome!}$v{description: glad you're here, {user.mention}}
```

## Simple parameters

These take a single value.

| Parameter     | Content                             |
| ------------- | ----------------------------------- |
| `message`     | Plain text sent alongside the embed |
| `title`       | The embed title                     |
| `description` | The embed body                      |
| `color`       | Hex code or color name              |
| `image`       | Large image URL                     |
| `thumbnail`   | Small corner image URL              |
| `timestamp`   | No content — just `{timestamp}`     |

### Colors

Hex works in three forms: `#5865f2`, `0x5865f2`, or bare `5865f2`. You can also use a name: `red`, `blue`, `green`, `purple`, `orange`, `gold`, `yellow`, `white`, or `black`.

## Multi-part parameters

These take several values separated by `&&`.

<AccordionGroup>
  <Accordion title="Author">
    Name, then optionally an icon URL and a link.

    <CodeGroup>
      ```javascript Syntax theme={null}
          {author: name && icon && url}
      ```

      ```javascript Example theme={null}
          {author: {user.display_name} && {user.avatar}}
      ```
    </CodeGroup>
  </Accordion>

  <Accordion title="Field">
    Name and value, both required. Add the word `inline` at the end of the value to sit fields side by side.

    <CodeGroup>
      ```javascript Syntax theme={null}
          {field: name && value}
      ```

      ```javascript Example theme={null}
          {field: joined && {user.joined_at} inline}
      ```
    </CodeGroup>

    Up to 25 fields per embed.
  </Accordion>

  <Accordion title="Footer">
    Text, then optionally an icon URL.

    <CodeGroup>
      ```javascript Syntax theme={null}
          {footer: text && icon}
      ```

      ```javascript Example theme={null}
          {footer: member #{guild.count} && {guild.icon}}
      ```
    </CodeGroup>
  </Accordion>

  <Accordion title="Button">
    Style, label, then a URL for link buttons or a custom ID for the rest. Add `disabled` last to grey it out.

    <CodeGroup>
      ```javascript Syntax theme={null}
          {button: style && label && url or id && disabled}
      ```

      ```javascript Example theme={null}
          {button: link && open spotify && https://open.spotify.com/...}
          {button: green && click me && my_button}
          {button: red && unavailable && my_button && disabled}
      ```
    </CodeGroup>

    Styles: `link`, `blurple`, `green`, `grey` (or `gray`), and `red`. Anything unrecognized falls back to grey.

    Buttons wrap automatically into rows of five.
  </Accordion>
</AccordionGroup>

## Image and link restrictions

<Warning>
  Confine only accepts URLs from a fixed set of hosts. Anything else is silently dropped — the image, icon, or link button simply won't appear.
</Warning>

Allowed hosts:

`cdn.discordapp.com` · `media.discordapp.net` · `images-ext-1.discordapp.net` · `images-ext-2.discordapp.net` · `last.fm` · `www.last.fm` · `lastfm.freetls.fastly.net` · `lastfm-img1.akamaized.net` · `lastfm-img2.akamaized.net`

<Tip>
  The simplest way to get a usable image link: upload it to any Discord channel, then copy the message link. That produces a `cdn.discordapp.com` URL confine accepts.
</Tip>

## A full example

```javascript theme={null}
{embed}$v{message: hey {user.mention}}$v{title: welcome to {guild.name}}$v{description: you're member number {user.join_position_suffix}}$v{color: #5865f2}$v{thumbnail: {user.avatar}}$v{field: joined && {user.joined_at_timestamp} inline}$v{footer: {guild.count} members}$v{timestamp}
```

## Common questions

<AccordionGroup>
  <Accordion title="How do I add a line break?">
    Press **Shift + Enter** while typing your message in Discord.
  </Accordion>

  <Accordion title="My embed says it produces no output">
    Confine validates scripts before saving. Usually this means every parameter was malformed — check that each one opens with `{`, closes with `}`, and that they're joined by `$v` with nothing stray in between.
  </Accordion>

  <Accordion title="Can I use `$v` or `}` inside my text?">
    No. Both are structural, so a literal `$v` splits your script and a stray `}` closes the parameter early.
  </Accordion>
</AccordionGroup>
