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

# Custom Messages

> Learn how to utilize custom messages and embeds inside the tickets system.

## Overview

The ticket system supports plain messages, embed blocks via `{embed}`, variables, and conditional logic.

<Info>
  When a message field is left blank, the system falls back to the built-in default for that message type.
</Info>

***

## Embed Syntax

To create an embed, start your message with `{embed}` and define fields using `$v{key: value}`.

**Supported keys:**

| Key           | Description                                                                       |
| ------------- | --------------------------------------------------------------------------------- |
| `title`       | Embed title                                                                       |
| `description` | Embed description                                                                 |
| `message`     | Appends text to the description                                                   |
| `color`       | Hex color code (e.g. `#2b2d31`)                                                   |
| `author`      | Author text, optionally `author name && icon_url`                                 |
| `footer`      | Footer text, optionally `footer text && icon_url`                                 |
| `field`       | Inline or regular field: `field name && value` or `field name && value && inline` |
| `thumbnail`   | URL for the embed thumbnail                                                       |
| `image`       | URL for the embed image                                                           |

### Basic Embed Example

```
{embed}
$v{title: Ticket #{ticket.case}}
$v{description: Welcome {ticket.author.mention}! Support will be with you shortly.}
$v{field: Type && {ticket.type} && inline}
$v{field: Opened && {ticket.opened_at} && inline}
```

### Form Submission Example

```
{embed}
$v{title: Ticket Intake}
$v{description: A new ticket was opened with the submitted form info.}
$v{field: User && {ticket.author.full} && inline}
$v{field: Reason && {ticket.form.field.reason}}
```

***

## Required Roles Message

Each option has its own **Required Roles** message inside the messages section of the option settings. Use this to explain to a member why they are not permitted to open that option.

* It is always sent ephemerally.
* Role mentions and `@everyone` are suppressed.
* Only the denied member can be mentioned.

***

## Conditional Blocks <Badge>Advanced</Badge>

Conditional blocks control what gets displayed based on a variable's value. They allow your messages to change dynamically depending on ticket state.

<Warning>
  Conditional blocks do not support nesting at this time.
</Warning>

### Supported Syntax

```
{if CONDITION}
content shown if condition is met
{elseif OTHER_CONDITION}
content shown if the elseif condition is met
{else}
content shown if nothing else matches
{/if}
```

### Condition Types

| Type             | Example                 |
| ---------------- | ----------------------- |
| Equality check   | `{ticket.var} == value` |
| Inequality check | `{ticket.var} != value` |
| Truthy check     | `{if {ticket.form.id}}` |

### Auto-Close Example

```
{embed}
$v{title: Ticket Closed}
$v{description: This ticket has been closed.}

{if {ticket.closed_automatically} == yes}
$v{message: This ticket was closed automatically due to inactivity.}
{else}
$v{message: This ticket was closed by staff.}
{/if}

$v{field: Reason && {ticket.reason.closed}}
```
