# Messages
<!--- Test "page" for the messages module. Can be accessed when changing the URL to "test" and is not shown in the sidebar. Only used for testing, copy/pasting, etc --->

<!-- Currently missing: 

- Images + GIF's, "Keep selection" option. Maybe also template folder grouping or so.

 -->

The <img src="_media/icons/messages.png" alt="" style="vertical-align: middle; width: 25px;">**Messages** module on Sapphire's dashboard provides a way to edit all of Sapphire's [default messages](/messages?id=default-messages), create custom [message templates](/messages?id=templates), and manage Sapphire's custom buttons and select menus.

The **Messages** module is divided into three sub-pages and two additional options:

- <img src="_media/icons/edit-pen.png" alt="" style="vertical-align: middle; width: 22px;"> **Templates** - Message Templates are your own custom messages. This module allows you to create, edit and send them.
- <img src="https://dashboard.sapph.xyz/assets/item-icons/components.svg" alt="" style="vertical-align: middle; width: 17px;"> **Components** - Manage your custom buttons and select menus.
- <img src="_media/icons/documents.png" alt="" style="vertical-align: middle; width: 21px;"> **Default messages** - Contains all of Sapphire's default messages that can be edited and customized.
- **Message Kits** - Share your default messages with other servers.
- **Send command message** - Manage the message that is sent when using the `sendmessage` command.
<!-- Needs to be updated properly. -->
<!-- ![Demonstration](https://cdn.discordapp.com/attachments/1104487793993990164/1104496925421621328/Animation.gif "center") -->

## <img src="_media/icons/edit-pen.png" alt="" style="vertical-align: middle; width: 30px;"> Templates

**Templates** are **custom messages** that can include **embeds**, **buttons**, or **select menus**. They can be easily **sent** to a channel, **scheduled** at an interval or on a specific date and **automated** based on keywords.

They are commonly used for button roles and announcement / sticky / information / rules messages.

###  Create a template
1. Navigate to <img src="_media/icons/messages.png" alt="" style="vertical-align: middle; width: 25px;">**Messages** ➜ <img src="_media/icons/edit-pen.png" alt="" style="vertical-align: middle; width: 22px;">**Templates**
2. Click the blue `Create new template` button.
3. Enter a name for the template, and click `Add`.
<!-- Insert gif here. -->

### Edit templates using the message editor
If you want to change the content of a template, click the created template and navigate to the `Edit` tab. You can use normal text, embeds, and components for editing.

By default, when you open the editor by clicking on a template, you'll be brought to the **Preview** tab. The **Preview** tab allows you to view a template without editing it.

#### Edit
The `Edit` tab contains three subcategories that allow you edit the template and change values about it.

|    Tab      |   Description  |
|-------------|----------------|
| **Visual**  | Fully customize the message using an intuitive editor. Add embeds, select menus, and buttons. |
| **Raw**     | View and edit the template’s raw JSON code for advanced customization. |
| **Variables** | Displays all available placeholders that dynamically insert content into messages. Click any variable to copy it. |

<img src="https://img-temp.sapph.xyz/34a4c2f4-ad66-41be-0c7e-bbbc7f9b2000" alt="" style="vertical-align: middle; width: 425px;">

#### Use
The `Use` tab contains four sub-categories to send, edit, schedule, or automate a template.

|   Option    |  Description   |
|-------------|----------------|
| **Send**    | Sends the current template to a selected channel. Enabling the `Webhook` option allows sending via a previously created webhook. |
| **Edit**    | Edits an already sent message instead of sending a new one. Copy the existing message link by right-clicking ➜ `Copy Message Link`. |
| **Schedule** | Schedules the template to be sent at specific times and dates. |
| **Automate** | Triggers the template based on user messages and keywords. |
| **Sticky**  | Ensures the template stays at the bottom of the channel. |

<div class="a-btn-list">
 <a target="_blank" href="/#/guides/schedule-message" class="btn external">Schedule information</a>
 <a target="_blank" href="/#/guides/automate-message" class="btn external">Automate information</a>
 <a target="_blank" href="/#/guides/sticky-message" class="btn external">Sticky information</a>
</div>

![`Use` ➜ `Send` tab of a template](https://img-temp.sapph.xyz/a7b5ceb3-aac0-4a1f-aef7-c52f62165500 "center")

## <img src="https://dashboard.sapph.xyz/assets/item-icons/components.svg" alt="" style="vertical-align: middle; width: 25px;"> Components: Buttons & menus
The <img src="https://dashboard.sapph.xyz/assets/item-icons/components.svg" alt="" style="vertical-align: middle; width: 17px;"> **Components** module is used to create and manage custom **buttons** and **select menus** that execute set actions when clicked.<br>

### What are components?
Components are interactive elements you can attach below messages to allow users to interact with the message. Sapphire supports two types of components:

- **Buttons**: Clickable button that triggers actions (e.g., sending a message, toggling roles).
- **Select Menus**: Dropdowns that allow users to choose from a list of options.

Each component can execute specific actions when clicked. This makes them ideal for informational messages, rules or button/menu roles.

<details>
<summary><span style="font-size: 1.1em; font-weight: bold;">📂 Action types for buttons and select menus</span></summary>

|  Action  |  Description  |
|-----------|---------------|
| **Send message** | Sends the selected message template into the channel. <br> ➜ *"Respond ephemeral" makes the message visible only to the user who clicked the button/menu and disappear after some time or when Discord is restarted.* |
| **Send channel message** | Sends the selected message template into a specific channel. |
| **Edit message** | Edits the message that has the button/menu attached with the selected template. |
| **Delete message** | Deletes the message with the button/menu. |
| **DM user** | Sends the selected template to the user's direct messages. |
| **Move users in voice** | Randomly moves a selected number of users between voice channels. |
| **Toggle roles** | Adds or removes the selected roles, depending on whether the user has the roles or not. |
| **Add roles** | Adds the selected roles. |
| **Remove roles** | Removes the selected roles. |
| **Set roles** | Removes all other roles and just adds the selected roles. |

</details>

<br>
<div class="a-btn-list">
 <a href="/#/guides/guide-to-components" class="btn external">A guide to components: Buttons & select menus</a>
 </div>

## <img src="_media/icons/documents.png" alt="" style="vertical-align: middle; width: 30px;"> Default messages
The **Default messages** module contains all of Sapphire's default messages that can be edited and customized. This may include error messages, log messages, command responses and more.

Editing Sapphire's default messages is a great way to personalize command responses to your server's unique style, preferences, and branding.

### Edit messages using the message editor
To edit a default message, click the pen (<img src="_media/icons/pen.png" alt="pen icon" style="vertical-align: middle; width: 18px;">) icon next to the message name. Sapphire's message editor will open that allows you to edit the message.

If you want to change the content of a message, click on the default message and navigate to the `Edit` tab. For that you can use normal text, embeds and components.

By default, when you open the editor by clicking on a message, you'll be brought to the **Preview** tab. The preview tab lets you view a message without being able to edit it.

#### Edit
The `Edit` tab contains three subcategories that allow you edit the template and change values about it.

| Tab         | Description    |
|-------------|----------------|
| **Visual**  | Fully customize the message using an intuitive editor. Add embeds, select menus, and buttons. |
| **Raw**     | View and edit the template’s raw JSON code for advanced customization. |
| **Variables** | Displays all available placeholders that dynamically insert content into messages. Click any variable to copy it. |

<img src="https://img-temp.sapph.xyz/74c17764-18d3-4965-33d9-ffb9ef680800" alt="" style="vertical-align: middle; width: 425px;">

## Message Kits
**Message Kits** are collections of default messages that can be shared between servers using a link. They are created by the Sapphire community.

They may include translations for various languages, different styles, or additional details. A list of user-created kits can be found in **#message-kits** in [Sapphire's support server](https://sapph.xyz/server).

### Manage your kits

When clicking the **Message Kits** option, you'll be given two options: **My Kits** and **Load Kit**.

| Option     |  Description  |
|------------|---------------|
| **My Kits** | 🔹 View your created kits. <br> 🔹 Create a new kit with your edited messages. |
| **Load Kit** | 🔹 Load an existing message kit using a link or ID. <br> 🔹 A list of user-created kits can be found in **#message-kits** in [Sapphire's support server](https://sapph.xyz/server). |

### Create a new kit
To create a **Message Kit**, click the `Message Kits` option, then on `My Kits`. This will display all created message kits for this server.

Selecting `Create` will give you the option to select **your already edited default messages** and create a new kit.
<!-- Include a step by step guide? -->

## Send command message
This option allows you to enable webhook messages when using the `sendmessage` command.

The default message `Send message command` is sent when **sending messages through Sapphire** using the `sendmessage` command.

It includes the `${content}` variable that represents the user's arguments when using the command.

If you style the message or remove the variable entirely, you can create a message with consistent and pre-configured content.

## Commands overview
<p style="font-size: 0.8em; color: #9e969a;">
  This feature can also be set up and managed via 
  <a href="https://dashboard.sapph.xyz/" target="_blank" rel="noopener noreferrer" style="color: #9e969a; text-decoration: underline;">
    Sapphire's dashboard
  </a>.
</p>

| Command | Description | Usage |
| --- | --- | --- |
| sendmessage | Sends a message into a specific channel. | sendmessage [channel] <message>
| sendtemplate | Sends a message template into a specific channel. | sendtemplate [[channel\|webhook url] <template name>] |