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

# Discord Integration

> Link a Discord server to your department and set channels, roles, nicknames, and log messages.

***

## Linking a Discord Server

Linking a Discord server lets your department sync shouts, post logs, and give roles and nicknames automatically. You need to be signed in to Melonly with Discord.

<Steps>
  <Step title="Open Discord Integration">
    Go to **Settings**, then **Discord Integration**.
  </Step>

  <Step title="Pick a server">
    Click a server marked **Click to Link**, then confirm with **Link**.
  </Step>

  <Step title="Invite the bot if needed">
    If Melonly isn't in that server yet, click **Invite Melonly bot**, add it in Discord, then come back and finish linking.
  </Step>
</Steps>

You need the Discord Administrator permission in the server. Each Discord server can only be linked to one Melonly server or department. If it's already linked elsewhere, unlink it there first or run `/unlink` in Discord.

<Frame caption="Linked Discord server">
  <img className="block" src="https://mintcdn.com/melonly/q2rOUZFah4X4li-3/images/Departments/Settings/discord-link.png?fit=max&auto=format&n=q2rOUZFah4X4li-3&q=85&s=578ac8595cebf7626e378d0f538dd6a5" alt="Linked Discord server card showing the server name and the Unlink button" style={{ borderRadius: '0.75rem' }} width="1918" height="989" data-path="images/Departments/Settings/discord-link.png" />
</Frame>

Click **Unlink** to disconnect. All Discord features stop until you link a server again.

***

## Channels

<Frame caption="Discord channels">
  <img className="block" src="https://mintcdn.com/melonly/q2rOUZFah4X4li-3/images/Departments/Settings/discord-channels.png?fit=max&auto=format&n=q2rOUZFah4X4li-3&q=85&s=3c21589d8dd15ff53ccfb28f0df5a528" alt="Channels section of the Discord Integration card" style={{ borderRadius: '0.75rem' }} width="1918" height="989" data-path="images/Departments/Settings/discord-channels.png" />
</Frame>

| Setting | Description |
| - | - |
| Shouts Channel | Two-way sync. Messages here show on the department home page, and shouts from Melonly post here. |
| Promotion & Demotion Shouts Channel | Sends promotion and demotion shouts here instead of the main shouts channel |
| Shift Logs Discord Channel | Shift starts, breaks and shift ends |
| Audit Logs Channel | [Audit log](/Department/settings#audit-logs) events |
| Leave of Absence Channel | LOA requests, decisions and endings |
| Activity End Wave Channel | A summary when an activity wave ends |
| Promotion Logs Channel | A log when a member is promoted |
| Demotion Logs Channel | A log when a member is demoted |

***

## Roles and Nicknames

| Setting | Description |
| - | - |
| On Shift Role | Given while a member is on shift |
| On Break Role | Given while a member is on break |
| LOA Role | Given while a member is on leave of absence |
| On Shift Nickname | Prefix added to the member's nickname while on shift. 3 to 15 characters. |
| On LOA Nickname | Prefix added to the member's nickname while on LOA. 3 to 15 characters. |
| Restrict Discord role selection | Stops people picking Discord roles at or above their own highest role anywhere in Melonly. On by default. Only Discord administrators and the server owner can turn it off. |

<Frame caption="Roles, nicknames and log channels">
  <img className="block" src="https://mintcdn.com/melonly/q2rOUZFah4X4li-3/images/Departments/Settings/discord-roles.png?fit=max&auto=format&n=q2rOUZFah4X4li-3&q=85&s=c31d9dbc0cb200ad25234a1ef99927fe" alt="Discord Role Protection switch with the On Shift, On Break and LOA roles, nickname prefixes, and promotion logs settings" style={{ borderRadius: '0.75rem' }} width="1918" height="989" data-path="images/Departments/Settings/discord-roles.png" />
</Frame>

***

## Custom Discord Messages

You can rewrite the messages Melonly sends to your shift, promotion and demotion log channels.

* For shift messages, click the sparkle icon next to Shift Logs Discord Channel and pick the event.
* For promotions and demotions, use the customise button under each log channel.

Each editor can also show the member in the embed's author line.

<Note>
  Settings marked Plus, like custom messages and promotion logs, are included with every department. No separate subscription needed.
</Note>

<AccordionGroup>
  <Accordion title="Shift message variables">
    | Variable | Available in | Description |
    | - | - | - |
    | `{user}` | All | The member whose shift changed |
    | `{mentionuser}` | All | Mentions the member |
    | `{eventtext}` | All | The full shift log text |
    | `{shifttype}` | All | The shift type, or Default |
    | `{startedat}` | Shift Started, Shift Ended | When the shift started |
    | `{endedat}` | Shift Ended | When the shift ended |
    | `{elapsedtime}` | Shift Ended | Length of the shift |
    | `{endedby}` | Shift Ended, Break Ended | Who ended the shift or break |
    | `{breakstartedat}` | Break Started, Break Ended | When the break started |
    | `{breakendedat}` | Break Ended | When the break ended |
    | `{breakelapsedtime}` | Break Ended | Length of the break |
  </Accordion>

  <Accordion title="Promotion and demotion variables">
    | Variable | Description |
    | - | - |
    | `{user}` | The member who was promoted or demoted |
    | `{mentionuser}` | Mentions that member |
    | `{rank}` | Their new rank |
    | `{promotedby}` / `{demotedby}` | Who made the change |
    | `{mentionpromotedby}` / `{mentiondemotedby}` | Mentions who made the change |
  </Accordion>

  <Accordion title="Time variables">
    | Variable | Example |
    | - | - |
    | `{time}` | 20 April 2021 16:20 |
    | `{timet}` | 16:20 |
    | `{timeT}` | 16:20:30 |
    | `{timed}` | 20/04/2021 |
    | `{timeD}` | 20 April 2021 |
    | `{timef}` | 20 April 2021 16:20 |
    | `{timeF}` | Tuesday, 20 April 2021 16:20 |
    | `{timeR}` | 2 months ago |
  </Accordion>
</AccordionGroup>

***

<Card title="Need help?" icon="headset" href="https://melonly.xyz/discord">
  Still have questions? Join our Discord server for support from the Melonly Team.
</Card>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.