# Tickets

> Set up a ticket panel and manage tickets

## Getting started

Run `/ticket-setup` to post a ticket panel. You can set the panel embed, title, description, image, color, footer and a role to ping, plus the embed shown inside each new ticket.

<Cmd cmd="/ticket-setup title:Support description:Pick a topic below to open a ticket." />

<discord-messages>
	<discord-message profile="aethor">
		<discord-embed slot="embeds" embed-title="Support" color="#5865f2">
			<discord-embed-description slot="description">Pick a topic below to open a ticket.</discord-embed-description>
		</discord-embed>
	</discord-message>
	<discord-message profile="aethor" ephemeral>
		Your ticket panel has no topics yet. Click below to add topic buttons.
		<discord-action-row slot="components">
			<discord-button type="primary">Set topics</discord-button>
		</discord-action-row>
	</discord-message>
</discord-messages>

The panel starts with no topic buttons. After setup, Aethor sends a private `Set topics` prompt. Click it, then:

1. Click `Add topic`.
2. Enter the topic label in the modal.
3. Choose the button color.
4. Repeat for more topics, then click `Done`.

The public panel is updated after each topic is added. Members can open tickets once at least one topic exists.

## Adding topics

Click "Add topic", enter a label in the modal, then pick a color on the next step. Discord modals cannot hold a color picker, so the color is a separate step. The color options map to Discord's button styles: Primary (blurple), Secondary (gray), Success (green) and Danger (red).

## Setting up the category

Tickets are created inside a category whose name is `tickets` (or one that contains the word tickets). The new ticket channel copies its permission overwrites from that category, so decide who can see tickets by editing the category permissions. The person who opened the ticket is always given access.

## What happens on close

Closing a ticket generates a transcript and posts it as a hosted link and as a `ticket.txt` file, both in the channel and in a DM to the opener. The channel is renamed from `ticket-name` to `closed-name` and a delete button appears.

## Catches and limits

- The bot must have Manage Channels to create, rename and delete ticket channels. `/ticket-setup` does not request this permission, so Discord will not warn you if it is missing. Ticket buttons just fail.
- There is one stored ticket setup per server. Running `/ticket-setup` again replaces the setup; the previous Discord panel message is not deleted automatically.
- Free servers get 5 topics, premium gets 20. Topic labels are 1 to 40 characters.
- Category name matching is case sensitive on close but not on create. A category named `Tickets` works when opening a ticket, but the permission re-sync on close may not find it. Use a lowercase `tickets` category to be safe.
- Transcripts only include the most recent 100 messages. Longer tickets are truncated. Attachments appear as links, not files.
- Anyone who can see the closed channel can press delete. There is no permission check on the delete button.
- There is no limit on open tickets per user, and no claim or reopen feature. Once closed, a ticket can only be deleted.
- A transcript link can be deleted by anyone who has the link by adding `/delete` to the end of the URL.
- A panel image must be a full `https://` link or setup is rejected.
- Discord allows 50 channels per category. A full category makes ticket creation fail with a generic error.
