> For the complete documentation index, see [llms.txt](https://mythicalbot.gitbook.io/arklynn-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mythicalbot.gitbook.io/arklynn-docs/resources/scripting/leave.md).

# Leave

### Basic Command

Run this command in the channel where you want leave messages to appear:

```
;setup_leave {embed}$v{color: #ef4444}$v{description: Goodbye, **{user.name}**!}$v{thumbnail: {user.avatar}}$v{timestamp}
```

### How It Works

1. You run `;setup_leave` with your embed template in the desired channel.
2. The bot saves that template.
3. Whenever a member leaves (or is kicked/banned), the bot automatically sends the saved template in that channel, replacing variables with real data.

To update the leave message, simply run `;setup_leave` again with a new embed.

***

### Available Variables for Leave Messages

| Variable         | Description                              |
| ---------------- | ---------------------------------------- |
| `{user.name}`    | Name of the member who left              |
| `{user.avatar}`  | Avatar URL of the member                 |
| `{user.mention}` | Mention (will not ping, since they left) |
| `{guild.name}`   | Name of your server                      |
| `{guild.icon}`   | Server icon URL                          |
| `{guild.count}`  | Member count **after** the departure     |
| `{timestamp}`    | Current time (automatically formatted)   |

> **Important:** Variables only work when the message is triggered automatically by a **member leave event**. Running `;setup_leave` manually sets the template – variables will appear as raw text at that moment.

***

### Examples

#### 1. Simple Goodbye Embed

```
;setup_leave {embed}$v{color: #ef4444}$v{title: Goodbye!}$v{description: **{user.name}** has left the server.}$v{thumbnail: {user.avatar}}$v{timestamp}
```

#### 2. Full Goodbye with Author, Field & Server Icon

```
;setup_leave {embed}$v{color: #ef4444}$v{author: {guild.name} && {guild.icon}}$v{description: Goodbye, **{user.name}** 😢\n\nHope to see you again.}$v{thumbnail: {user.avatar}}$v{field: Members remaining && {guild.count} && inline}$v{timestamp}
```

#### 3. Alternative Style – Orange / Warm Goodbye

```
;setup_leave {embed}$v{color: #f59e0b}$v{description: **{user.name}** has left the server.\n\nWe now have **{guild.count}** members.}$v{footer: {guild.name}}$v{timestamp}
```

#### 4. Complete Example with Button (e.g., invite back)

```
;setup_leave {embed}$v{color: #ef4444}$v{title: 😢 A member left}$v{description: **{user.name}** is no longer with us.}$v{field: Server size && {guild.count} members && true}$v{button: link && Invite them back && https://discord.gg/your-invite}$v{footer: Left at}{timestamp}
```

***

### Multiple Embeds? (Important Note)

The example you provided shows two separate `{embed}` blocks. **The bot currently supports only one embed per `;setup_leave` command.** If you want multiple embeds, you would need to run `;setup_leave` twice (overwriting the previous template) – which is not recommended.

Instead, combine all desired elements into a **single embed**. You can use `\n` line breaks and multiple fields to structure your message.

***

### Tips & Best Practices

* **Use red/orange tones** for leave messages – fits the mood. Examples: `#ef4444` (red), `#f59e0b` (orange), `#dc2626` (dark red).
* **Line breaks** – use `\n` inside `description` or field values.
* **No ping** – `{user.mention}` will show as `<@ID>` but won't ping (the member is gone).
* **Test first** – use a private test channel to design your embed, then move to your public channel with `;setup_leave`.
* **Button URLs** – must start with `https://` or `http://` (e.g., invite link).

***

### Interactive Builder (Recommended)

Design your leave embed visually at:\
[**arklynn.xyz/embed**](https://arklynn.xyz/embed)

After designing, copy the generated command and **replace `;ann #channel` with `;setup_leave`** before sending.

***

### Troubleshooting

| Issue                                        | Solution                                                                                                                                            |
| -------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| Variables appear as raw text (`{user.name}`) | This is normal when running `;setup_leave` – the command stores the *template*. Variables will be replaced automatically when a real member leaves. |
| No leave message appears                     | Make sure you ran `;setup_leave` at least once in that channel. Also verify the bot has `Send Messages` and `Embed Links` permissions.              |
| Two embeds in my example don't work together | The bot only supports one embed per template. Combine everything into one `{embed}` block.                                                          |
| Button doesn't show                          | Ensure the URL starts with `https://` or `http://`.                                                                                                 |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://mythicalbot.gitbook.io/arklynn-docs/resources/scripting/leave.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
