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

# Ticket System

> A complete support system for your server.

Flamey provides a professional ticket system to handle user inquiries, reports, and applications privately. It supports two operational modes: **Server Tickets** (users interact with panels inside your server) and **Modmail** (users DM the bot to open private support threads).

## Features at a Glance

<CardGroup cols={4}>
  <Card title="Dual Mode" icon="arrows-left-right">
    Server ticket panels or DM-based Modmail — choose what fits your community.
  </Card>

  <Card title="Transcripts" icon="file-invoice">
    Save HTML transcripts of closed tickets with full message history, embeds, and attachments.
  </Card>

  <Card title="Multi-Category" icon="layer-group">
    Support for multiple ticket categories per panel with custom forms and welcome messages.
  </Card>

  <Card title="AI Powered" icon="robot">
    Auto-respond, detect spam, and generate close summaries with configurable AI models.
  </Card>
</CardGroup>

## System Modes

Flamey offers two distinct support modes that you can switch between at any time from the Dashboard.

### Server Tickets (Default)

Users open tickets by clicking buttons or selecting options from interactive panels posted in your server channels. Each ticket creates a private channel where staff and the user can communicate.

* Panels support **buttons** or **dropdown select menus**
* Tickets can be created as **channels**, **threads**, or **forum posts**
* Multiple panels per server, each with its own categories and FAQ

### Modmail System

Users send a direct message to the bot, which creates a private thread in your server. Staff reply from the server, and the bot relays messages to the user's DMs.

* No panels needed — users simply DM the bot
* Staff can remain **anonymous** (messages appear from the bot)
* Works across servers the user shares with the bot via `/modmail create`

<Info>Switch modes anytime from **Dashboard → Tickets** using the **Switch Mode** button (↻ icon) in the intro card. Your configuration for each mode is preserved separately.</Info>

## Ticket Lifecycle

<Steps>
  <Step title="User Opens Ticket">
    The user clicks a button on the ticket panel (or DMs the bot in Modmail mode). A private channel is created using the configured naming format (e.g., `#support-johndoe`).
  </Step>

  <Step title="Form Submission (Optional)">
    If the category has custom form fields configured, the user fills them out before the ticket is created. Responses are posted in the welcome message.
  </Step>

  <Step title="Welcome Message">
    A customizable welcome embed is posted in the new channel. It can include the user's avatar, helpful links, and instructions.
  </Step>

  <Step title="Staff Claiming">
    Staff members click the **Claim** button to assign the ticket to themselves. Depending on claiming behavior, the ticket may be hidden from other staff or locked for exclusive access.
  </Step>

  <Step title="Resolution">
    Staff and the user communicate. Staff can add/remove users, set priority, add internal notes, and use the **Notify Staff** button to ping the team.
  </Step>

  <Step title="Closing">
    Once resolved, staff or the user can click **Close**. A close reason can be required (configurable). If rating is enabled, the user is asked to rate their experience.
  </Step>

  <Step title="Archiving">
    An HTML transcript is generated and sent to the logs channel. The ticket channel is renamed (e.g., `closed-johndoe`) and optionally moved to an archive category, then deleted.
  </Step>
</Steps>

## Dashboard Configuration

The dashboard is the recommended way to configure the ticket system. Navigate to **Dashboard → Tickets** in your server.

### Intro Card

The intro card at the top shows the current mode (Ticket System or Modmail System) and provides quick actions:

* **Enable/Disable Toggle** — Turn the entire ticket system on or off for the server
* **Switch Mode** (↻) — Toggle between Server Tickets and Modmail
* **Reset to Default** — Reset transcripts, tickets, or configuration to defaults
* **Docs** — Quick link to this documentation page

### Hub Tabs

<Tabs>
  <Tab title="Panels">
    <Steps>
      <Step title="Create a Panel">
        Click **"New Panel"** to create your first ticket panel. Each panel can have multiple categories.
      </Step>

      <Step title="Design the Panel">
        Customize the panel's appearance:

        * **Title** and **Description** — The main message users see
        * **Accent Color** — Brand color for the embed sidebar
        * **Thumbnail & Image** — Visual elements for the panel embed
        * **Panel Type** — Choose between **Buttons** (each category is a button) or **Select Menu** (dropdown selector)
        * **Link Buttons** — Add external links (rules, website, etc.) to the panel
      </Step>

      <Step title="Create Categories">
        Add categories to define different ticket types. Each category represents a reason users can open a ticket (e.g., "General Support", "Bug Report", "Billing").
      </Step>

      <Step title="Configure Category Details">
        For each category, you can configure:

        * **Label & Emoji** — How the category appears on buttons/select menu
        * **Button Style** — Primary, Secondary, Success, or Danger
        * **Description** — Shown in select menu dropdowns
        * **Staff Roles** — Which roles can view and manage tickets in this category
        * **Required Roles** — Roles users must have to open this category
        * **Restricted Roles/Members** — Block specific roles or users from this category
        * **Max Open Tickets** — How many tickets a user can have open in this category simultaneously
        * **Target Category/Channel** — Where ticket channels are created
        * **Forum Tag** — Auto-apply a tag when using forum channels
        * **Overflow Category** — Fallback category if the target is full
        * **Channel Name Format** — Custom naming with variables: `{username}`, `{nickname}`, `{id}`, `{ticket_count}`
        * **Closed Name Format** — How the channel is renamed after closing
        * **Closed Archive Category** — Move closed tickets to a specific category before deletion
        * **Log Channel** — Per-category log channel override
        * **Cooldown** — Per-category cooldown between ticket openings
        * **Ping Staff on Open** — Automatically ping staff roles when a ticket is created
      </Step>

      <Step title="Customize Welcome Message">
        Design the embed that appears when a ticket is opened:

        * **Title & Description** — Use `{user}` to mention the ticket opener
        * **Color** — Custom accent color for the welcome embed
        * **Thumbnail** — Use `{user_avatar}` to show the user's avatar
        * **Image** — Large image in the embed
        * **Show User Avatar** — Toggle avatar display in the welcome message
        * **Link Buttons** — Add helpful links to the welcome embed
        * **Pin Welcome Message** — Automatically pin the welcome message
      </Step>

      <Step title="Configure Buttons">
        Customize the action buttons that appear in the ticket channel:

        * **Close Button** — Label, emoji, and color. Optional confirmation prompt.
        * **Claim Button** — Label, emoji, and color for staff claiming
        * **Notify Staff Button** — Label, emoji, color, and cooldown between uses
        * **Ask Close Reason** — Prompt the closer for a reason
        * **Close Reason Required** — Make the reason mandatory
        * **Save Transcripts** — Per-category transcript toggle
        * **Users Can Close** — Allow non-staff to close their own tickets
      </Step>

      <Step title="Add Form Fields">
        Collect information from users before the ticket is created. Available field types:

        * **Short Text** — Single-line text input
        * **Paragraph** — Multi-line text input
        * **Number** — Numeric input
        * **String Select** — Dropdown menu with custom options
        * **Radio Group** — Radio button selection
        * **Checkbox Group** — Multiple selection checkboxes
        * **File Upload** — Allow users to attach files
        * **Text Display** — Show informational text (not an input)
        * **User Select** — Select a Discord user
        * **Role Select** — Select a Discord role
        * **Channel Select** — Select a Discord channel
        * **Date Picker** — Date selection
      </Step>

      <Step title="Set Up FAQ (Optional)">
        Add frequently asked questions to your panel to help users before they open a ticket:

        * **FAQ Title & Description** — Header for the FAQ section
        * **FAQ Button** — Custom label, emoji, and style
        * **FAQ Accent Color** — Brand color for FAQ embeds
        * **FAQ Image/Thumbnail** — Visual elements for FAQ answers
        * **Questions & Answers** — Rich text with link buttons per answer
        * **FAQ Select Placeholder** — Placeholder text for the FAQ dropdown
      </Step>

      <Step title="Send the Panel">
        Select a target channel and click **"Send Panel"**. The panel will be posted and users can start opening tickets.
      </Step>
    </Steps>
  </Tab>

  <Tab title="Configuration">
    ### General Configuration

    * **Users Can Close** — Allow ticket openers to close their own tickets
    * **Rating System** — Let users rate their support experience (1-5 stars) after closing
    * **DM Transcripts** — Send a copy of the transcript to the user's DMs when a ticket closes
    * **Ticket Priority** — Enable priority levels (Urgent, High, Medium, Low) for tickets
    * **Priority Emoji in Channel Name** — Prefix channel names with priority emojis (🔴, 🟠, 🟡, 🟢)
    * **Transcript Retention** — How long transcripts are stored (3, 7, 14, or 30 days)
    * **Opening Cooldown** — Global cooldown between ticket openings (seconds, minutes, hours, or days)
    * **Global Blacklist** — Block specific users or roles from opening any tickets

    ### Staff Configuration

    * **Staff Claiming** — Enable or disable the claim system entirely
    * **Anonymous Staff** — *(Modmail only)* Staff replies appear from the bot, hiding their identity
    * **Auto-Claim on Reply** — Automatically claim a ticket when a staff member replies to it
    * **Claiming Behavior** — What happens when a staff member claims a ticket:
      * **Hide from other staff** — The ticket channel becomes invisible to other staff
      * **Keep Access** — Other staff can still see and reply
      * **Lock others from replying** — Other staff can see but cannot reply

    ### Auto-Close System

    * **Enable/Disable** — Toggle automatic closing of inactive tickets
    * **Close on Leave** — Automatically close the ticket if the opener leaves the server
    * **DM Opener on Close** — Send a DM to the user when their ticket is auto-closed
    * **Send Reminder After** — How long to wait before sending an inactivity warning
    * **Close After Warning** — How long after the warning before the ticket is closed

    ### Logs Channel

    Select a channel where transcripts and ticket logs will be sent.
  </Tab>

  <Tab title="Support Hours">
    Configure when your support team is available. Outside of support hours, you can control ticket creation behavior.

    * **Enable/Disable** — Toggle support hours on or off
    * **Timezone** — Set your team's timezone (24 timezone options available)
    * **Status** — Set the overall status: Available, Away, or Busy
    * **Creation Behavior** — What happens when users try to open tickets outside hours:
      * **Allow** — Tickets open normally regardless of hours
      * **Allow with Warning** — Tickets open but the user sees a warning about delayed response
      * **Deny** — Tickets cannot be opened outside support hours
    * **Disable Pings** — Suppress staff pings outside support hours
    * **Daily Schedule** — Set custom time blocks for each day of the week (Sunday–Saturday)
    * **Temporary Override** — Set a temporary override that expires at a specific time

    <Tip>Support hours are useful for communities that only provide support during business hours or specific time windows.</Tip>
  </Tab>

  <Tab title="AI">
    Configure AI-powered features for your ticket system.

    * **Enable AI** — Master toggle for all AI features
    * **AI Model** — Choose the AI model (e.g., `llama-3.3-70b-versatile`)
    * **Credits Limit** — Maximum AI credits per month (default: 500)
    * **Credits Used** — Track AI usage (resets monthly)

    #### AI Actions

    * **Reply in Ticket** — AI automatically responds to ticket messages with helpful suggestions
    * **Close Spam Tickets** — AI detects and closes spam/troll tickets automatically
    * **Close Summary** — AI generates a summary when a ticket is closed, included in the transcript

    <Warning>AI features consume credits. Monitor your usage in the AI tab to avoid unexpected service interruptions.</Warning>
  </Tab>

  <Tab title="View Tickets">
    Manage active tickets and view past transcripts.

    #### All Tickets

    * View all currently open tickets across all panels and categories
    * **Search** tickets by number, category name, or user
    * **Filter** by category, priority level, and sort by newest/oldest
    * Click any ticket to open the **Ticket Details** modal with full information:
      * Ticket number, type (Ticket/Modmail), category, priority
      * Opener, claimed by, timestamps
      * **Actions**: Claim, Unclaim, Assign to staff, Add User, Remove User, Set Priority, Close, Delete
    * **Close with Reason** — Provide an optional closing reason
    * **Delete** — Permanently delete a ticket and its Discord channel

    #### Transcripts

    * Browse all saved transcripts with search and filtering
    * Each transcript shows: ticket number, category, opener, closed by, closing reason, timestamp
    * View ratings and user feedback if rating is enabled
    * **Delete Transcripts** — Remove individual transcripts permanently

    <Info>Transcripts are HTML files that look exactly like Discord chat. They include all messages, embeds, attachments, timestamps, and user avatars. You can view them in any web browser.</Info>
  </Tab>
</Tabs>

## Commands

The ticket system includes a comprehensive set of slash commands. You can also manage permissions per command from the **Dashboard → Commands** page.

### `/ticket` — Main Router

The primary command hub. All subcommands are registered under `/ticket`:

| Command                           | Description                                                    | Permissions           |
| --------------------------------- | -------------------------------------------------------------- | --------------------- |
| `/ticket add @user`               | Add a user to the current ticket                               | Staff or Ticket Owner |
| `/ticket remove @user`            | Remove a user from the current ticket                          | Staff or Ticket Owner |
| `/ticket claim`                   | Claim the ticket for yourself                                  | Staff                 |
| `/ticket unclaim`                 | Release your claim on the ticket                               | Staff                 |
| `/ticket close [reason]`          | Close the ticket with an optional reason                       | Staff or Ticket Owner |
| `/ticket delete`                  | Permanently delete the ticket and generate transcript          | Manage Channels       |
| `/ticket reopen`                  | Reopen a previously closed ticket                              | Staff or Ticket Owner |
| `/ticket info`                    | Show ticket details (status, priority, timestamps, claimed by) | Anyone in ticket      |
| `/ticket requestclose`            | Ask the ticket opener to confirm closing                       | Staff                 |
| `/ticket priority <level>`        | Set priority: `urgent`, `high`, `medium`, `low`, or `unset`    | Staff                 |
| `/ticket note <ticket> <content>` | Set an internal staff note on a ticket                         | Staff                 |

### `/modmail` — Modmail Commands

| Command                    | Description                                                         |
| -------------------------- | ------------------------------------------------------------------- |
| `/modmail create <server>` | Open a modmail ticket with a specific server you share with the bot |

### `/staff` — Staff Statistics

| Command               | Description                                                          |
| --------------------- | -------------------------------------------------------------------- |
| `/staff stats [user]` | View ticket handling statistics for yourself or another staff member |
| `/staff leaderboard`  | See the top-performing staff members ranked by tickets handled       |

<Tip>
  The `/ticket` command is automatically synced to your server when the ticket system is enabled. Disabling the system removes the command.
</Tip>

## Custom Message Templates

You can customize the bot's default messages for ticket events from **Dashboard → Messages**.

| Template ID                   | Event              | Default Content                                                         |
| ----------------------------- | ------------------ | ----------------------------------------------------------------------- |
| `tickets.claimed`             | Ticket Claimed     | `This ticket has been claimed by {user}. They will assist you shortly.` |
| `tickets.closed`              | Ticket Closed      | `Ticket closed by {user}. Reason: {reason}`                             |
| `tickets.notify`              | Staff Notified     | `{user} is requesting assistance in this ticket.`                       |
| `tickets.auto_close_reminder` | Inactivity Warning | `{user}, this ticket will close in {time} due to inactivity.`           |
| `tickets.auto_closed`         | Auto Closed        | `Ticket closed automatically. Reason: {reason}`                         |

## Staff Statistics

Track your team's performance with detailed insights.

<CardGroup cols={2}>
  <Card title="Individual Stats" icon="user-chart">
    `/staff stats [user]`
    View how many tickets a staff member has claimed and closed, average response time, and average rating.
  </Card>

  <Card title="Leaderboard" icon="trophy">
    `/staff leaderboard`
    See who is handling the most tickets in your server, ranked by tickets, rating, or response time.
  </Card>
</CardGroup>

## Transcripts

When a ticket is closed, an HTML transcript is automatically generated.

<Accordion title="How do transcripts work?" icon="file-code">
  Transcripts are HTML files that look exactly like Discord chat. They include:

  * All messages and embeds with full formatting
  * Attachments and images
  * Stickers and reactions
  * Timestamps and user avatars
  * Pinned messages
  * AI-generated close summaries (if enabled)

  You can view them in any web browser. They are stored securely and a permanent link is provided in your logs channel. Transcripts are automatically cleaned up after the configured retention period (3, 7, 14, or 30 days).
</Accordion>

<Warning>
  You must set a **Logs Channel** in the Dashboard for transcripts to be saved!
</Warning>

## Channel Name Variables

When configuring channel name formats, you can use the following variables:

| Variable         | Description               | Example              |
| ---------------- | ------------------------- | -------------------- |
| `{username}`     | User's Discord username   | `johndoe`            |
| `{nickname}`     | User's server nickname    | `John`               |
| `{id}`           | User's Discord ID         | `123456789012345678` |
| `{ticket_count}` | User's total ticket count | `5`                  |

## Priority Levels

When priority is enabled, tickets can be assigned one of four levels:

| Priority | Emoji | Description                               |
| -------- | ----- | ----------------------------------------- |
| Urgent   | 🔴    | Critical issue, needs immediate attention |
| High     | 🟠    | Important issue, prioritize soon          |
| Medium   | 🟡    | Standard support request                  |
| Low      | 🟢    | Non-urgent, can wait                      |

If **Priority Emoji in Channel Name** is enabled, the emoji is prefixed to the channel name (e.g., `🔴-support-johndoe`).

## Claiming Behavior

When a staff member claims a ticket, the configured behavior determines what happens:

| Behavior                      | Other Staff Can See | Other Staff Can Reply |
| ----------------------------- | ------------------- | --------------------- |
| **Hide from other staff**     | ❌ No                | ❌ No                  |
| **Keep Access**               | ✅ Yes               | ✅ Yes                 |
| **Lock others from replying** | ✅ Yes               | ❌ No                  |

## Ticket Mediums

Each panel can create tickets in one of three channel types:

| Medium      | Description                                                                      |
| ----------- | -------------------------------------------------------------------------------- |
| **Channel** | Creates a new text channel under a category. Best for most servers.              |
| **Thread**  | Creates a thread under a specified text channel. Good for keeping channels tidy. |
| **Forum**   | Creates a post in a forum channel. Supports auto-tagging with forum tags.        |

## Form Field Types

When creating custom forms for ticket categories, the following field types are available:

| Type             | Description            | User Input          |
| ---------------- | ---------------------- | ------------------- |
| `short_text`     | Single-line text input | Text                |
| `paragraph`      | Multi-line text input  | Long text           |
| `number`         | Numeric input          | Number              |
| `string_select`  | Dropdown menu          | Single choice       |
| `radio_group`    | Radio buttons          | Single choice       |
| `checkbox_group` | Checkboxes             | Multiple choices    |
| `file_upload`    | File attachment        | Uploaded file       |
| `text_display`   | Informational text     | None (display only) |
| `user_select`    | Discord user picker    | Selected user       |
| `role_select`    | Discord role picker    | Selected role       |
| `channel_select` | Discord channel picker | Selected channel    |
| `date_picker`    | Date selection         | Selected date       |

<Info>All form field responses are posted in the welcome message when the ticket is created, giving staff immediate context about the user's request.</Info>

## FAQ System

Each panel can include an FAQ section that users can browse before opening a ticket. This helps reduce unnecessary tickets by answering common questions upfront.

* FAQ appears as a button on the panel (or a select menu option)
* Each FAQ entry has a **question**, **answer**, optional **emoji**, and **description**
* Answers support rich text with link buttons
* FAQ entries can have custom thumbnails, images, titles, and descriptions
* The FAQ button label, emoji, and style are fully customizable

## Reset Options

The **Reset to Default** button in the intro card allows you to selectively reset parts of the ticket system:

* **Delete all transcripts** — Removes all saved transcript records
* **Delete all tickets** — Removes all open and closed ticket records
* **Reset configuration** — Resets all settings, panels, and categories to defaults

<Warning>
  Reset actions are **irreversible**. Use with caution!
</Warning>
