# Ticket System

### Overview

The ticket system is a complete support solution, offering:

* Multiple ticket types
* Role-based priorities
* Working hours
* Claiming & auto-alerts
* Transcripts, closure messages & reviews
* Detailed logging

***

### Core Settings

#### General Setup

```yml
TicketSettings:
  Enabled: false
  LogsChannelID: "CHANNEL_ID"
  MaxTickets: 1
  DeletionTime: "3s"
  useSelectMenu: true
  overFlow: ["CATEGORY_ID", "CATEGORY_ID"]
```

* **Enabled** → Master switch
* **LogsChannelID** → Channel where all ticket events are logged (open, close, claim)
* **MaxTickets** → Limit how many tickets a single user can have at once
* **DeletionTime** → Delay before a ticket is fully deleted after closure
* **useSelectMenu** → `true` = dropdown menus, `false` = buttons
* **overFlow** → Backup categories if the main one reaches 50 channels

***

#### Delayed Response System

Warns users when many tickets are open.

```yml
DelayedResponse:
  Enabled: false
  TicketThreshold: 25
  Embed:
    Title: ""
    Description:
      - "# 🎫 High Support Volume Notice"
      - "⚠️ We are currently experiencing higher than usual ticket volume."
      - "## Current Status"
      - "> 📊 **Active Tickets:** {openTickets}"
      - "> ⏱️ **Est. Response Time:** 24-48 hours"
```

* **TicketThreshold** → When this many open tickets exist, the warning is shown
* **Embed** → Fully customizable (placeholders like `{openTickets}` work)

***

#### Close Reasons

```yml
CloseReasons:
  Enabled: true
  DefaultReason: "No reason provided"
  Reasons:
    - name: "Issue Resolved"
      emoji: "✅"
      value: "resolved"
    - name: "User Request"
      emoji: "👋"
      value: "user_request"
```

* Adds **preset closure reasons** staff can pick
* **AllowCustomReason** → lets staff write their own

***

### Priority System

```yml
Priority:
  Enabled: true
  DefaultPriority: "Low"

  Levels:
    High:
      Roles: ["ROLE_ID"]
      Tag: ["ROLE_ID"]
      MoveTop: true
```

* **Levels** → Low / Medium / High (add more if needed)
* **Roles** → Who gets assigned this priority
* **Tag** → Roles to ping when tickets open
* **MoveTop** → Moves priority tickets to the top of the category

***

### Working Hours

```yml
WorkingHours:
  Enabled: false
  Timezone: Europe/London
  NonWorkingDays: ["Saturday", "Sunday"]
  Schedule:
    Monday: "16:00-22:00"
  allowOpenTickets: true
```

* **Timezone** → Must be [IANA format](https://gist.github.com/diogocapela/12c6617fc87607d11fd62d2a4f42b02a) (e.g. `America/New_York`)
* **Schedule** → Define start/end times
* **allowOpenTickets** → Allow tickets outside hours? If yes, a warning embed (`WorkingEmbed`) is shown.

***

### Ticket Panels

Panels are what users see when opening tickets.

```yml
TicketPanelSettings:
  Panel1:
    Embed:
      Title: "📩 Support Tickets"
      Description:
        - "Please select a category below for assistance."
```

* You can create multiple (`Panel1`, `Panel2`...)
* Each panel controls how ticket buttons/menus look

***

### Ticket Creation Templates

```yml
TicketCreation:
  Default:
    Embed:
      Title: "🎫 New Support Ticket"
      Description:
        - "Welcome {user}!"
        - "**Ticket Type:** {ticketType}"
        - "**Claimed By:** {claimer}"
        - "{questions}"
```

* Defines the **first message inside the ticket**
* Supports placeholders like `{user}`, `{ticketType}`, `{claimer}`, `{questions}`
* You can also make ticket-type-specific templates (`TicketType1`, `TicketType2`)

***

### Ticket Types

Each type is its own config block.

{% code expandable="true" %}

```yml
TicketTypes:
  TicketType1:
    Enabled: true
    Panel: "Panel1"
    Name: "General Support"
    ChannelName: "{ticket-id}-General-{user}-{priority}"
    CategoryID: "CATEGORY_ID"
    SupportRole: ["ROLE_ID"]
    Claiming:
      Enabled: false
    Button:
      Name: "General Support"
      Emoji: "🔍"
      Style: "Danger"
      Description: "Open to receive general support"
```

{% endcode %}

* **Panel** → Which panel it belongs to
* **ChannelName** → Use placeholders like `{ticket-id}`, `{user}`, `{priority}`
* **SupportRole** → Who can access tickets
* **Claiming** → Restrict tickets to one staff member
* **Button** → Text, emoji, color, description

***

### Questions with Select Options

Both the ticket and review systems support **select menus** in modals, allowing users to choose from preset options instead of typing. This ensures consistent data and a smoother user experience.

#### Ticket Questions

You can add questions to any ticket type. Questions can be **text inputs** or **select menus**.

**Example:**

{% code expandable="true" %}

```yaml
TicketTypes:
  TicketType1:
    Questions: 
      - PurchaseID:
          Question: "Do you have a transaction ID?"
          Placeholder: "TBX-wdUGVApxKSMXham"
          Style: "Short" # Short, Paragraph
          Required: false
          maxLength: 1000
      - IssueType:
          Type: "StringSelect"
          Question: "What type of issue are you experiencing?"
          Description: "Please select the category that best describes your issue"
          Placeholder: "Choose an issue type..."
          Required: true
          Options:
            - Label: "Bug Report"
              Value: "bug"
              Description: "Something isn't working as expected"
              Emoji: "🐛"
            - Label: "Other"
              Value: "other"
              Description: "Something else not listed above"
              Emoji: "❓"
```

{% endcode %}

#### Question Types

**Text Input**

* `Question` → The question text
* `Placeholder` → Example text
* `Style` → `"Short"` (1 line) or `"Paragraph"` (multi-line)
* `Required` → true/false
* `maxLength` → Character limit

**Select Menu**

* `Type` → `"StringSelect"`
* `Question` → Text shown above dropdown
* `Description` → Helper text (optional)
* `Placeholder` → Text when no option is selected
* `Required` → true/false
* `Options` → List of choices

Each **option** includes:

* `Label` → What users see
* `Value` → Internal stored value
* `Description` → Shown under label
* `Emoji` → Optional icon

***

#### Review System Questions

The review system works similarly but is designed for rating support quality.

{% code expandable="true" %}

```yaml
Reviews:
  Enabled: false
  Placeholder: "Rate us!"
  ButtonEmoji: "⭐"
  ButtonStyle: "Secondary" # Primary, Secondary, Success, Danger
  
  Questions:
    1:
      ID: "support_quality"
      Label: "Support Quality (1-5)"
      Description: "Rate the quality of support you received"
      Required: true
      Options:
        - Label: "Very Poor"
          Value: "1"
          Emoji: "😞"
        - Label: "Poor"
          Value: "2"
          Emoji: "😐"
        - Label: "Average"
          Value: "3"
          Emoji: "🙂"
        - Label: "Good"
          Value: "4"
          Emoji: "😊"
        - Label: "Excellent"
          Value: "5"
          Emoji: "😍"
```

{% endcode %}

***

### Alerts

{% code expandable="true" %}

```yml
Alert:
  Enabled: true
  Time: "12h"
  DM:
    Enabled: true
    Embed:
      Title: "⚠️ Ticket Alert"
      Description:
        - "Hello {user}"
        - "> **Time Until Close:** {time}"
      Footer:
        Text: "Drako Development | Ticket System"
        Icon: "https://i.imgur.com/w5XxKpc.png"
      Author:
        Text: "Ticket Alert System"
        Icon: "https://i.imgur.com/w5XxKpc.png"
      Color: "#FF0000"
      Image: ""
      Thumbnail: ""
    Button:
      Label: "Go to Ticket"
      Emoji: "🎫"
```

{% endcode %}

* Reminds users before closure
* Can send via DM (with fallback log if DM fails)
* Also posts a warning inside the ticket

***

### Ticket Closure DM

{% code expandable="true" %}

```yml
TicketClosureDM:
  Enabled: true
  Transcript: true
  Embed:
    Title: "Ticket Closure Notification"
    Description:
      - "{userTag}, your ticket in {guild} has been closed."
      - " "
      - "**Ticket Summary**"
      - "> **Messages:** {messageCount}"
      - "> **Priority:** {priority}"
      - "> **Handled By:** {claimer}"
      - "> **Close Reason:** {reason}"
      - " "
      - "We value your feedback! Please leave us a review below."
    Footer:
      Text: "Drako Development | Ticket System"
      Icon: "https://i.imgur.com/w5XxKpc.png"
    Author:
      Text: "Drako Support"
      Icon: "https://i.imgur.com/w5XxKpc.png"
    Color: "#1769FF"
    Image: "https://images-ext-1.discordapp.net/external/OllWGq5ta58LX6KoA8yEVTMrI9L4BJ0iE_T0pE4TZvw/https/i.imgur.com/LbjDuZ8.png?format=webp&quality=lossless&width=1618&height=403"
    Thumbnail: "https://i.imgur.com/w5XxKpc.png"
```

{% endcode %}

* Sends users a DM when their ticket closes
* Includes summary and optional transcript

***

### Reviews

The review system lets users rate their support experience after a ticket is closed. They’ll get a DM with a **Leave a Review** button, which opens a simple modal where they can rate different aspects of the support they received.

Here’s what the config looks like:

{% code expandable="true" %}

```yaml
Reviews:
  Enabled: false
  Placeholder: "Rate us!"
  ButtonEmoji: "⭐"
  ButtonStyle: "Secondary" # Primary, Secondary, Success, Danger
  
  # Multiple rating questions that will appear as select dropdowns in the modal
  Questions:
    1:
      ID: "support_quality"
      Label: "Support Quality (1-5)"
      Description: "Rate the quality of support you received"
      Required: true
      Options:
        - Label: "Very Poor"
          Value: "1"
          Emoji: "😞"
        - Label: "Poor"
          Value: "2"
          Emoji: "😐"
        - Label: "Average"
          Value: "3"
          Emoji: "🙂"
        - Label: "Good"
          Value: "4"
          Emoji: "😊"
        - Label: "Excellent"
          Value: "5"
          Emoji: "😍"
    
    2:
      ID: "response_time"
      Label: "Response Time (1-5)"
      Description: "Rate how quickly we responded to your ticket"
      Required: true
      Options:
        - Label: "Very Slow"
          Value: "1"
          Emoji: "🐌"
        - Label: "Slow"
          Value: "2"
          Emoji: "⏳"
        - Label: "Average"
          Value: "3"
          Emoji: "⏰"
        - Label: "Fast"
          Value: "4"
          Emoji: "⚡"
        - Label: "Very Fast"
          Value: "5"
          Emoji: "🚀"
  
  # Optional feedback text input
  FeedbackInput:
    Enabled: true # Should the bot ask the user why for the review they gave?
    Label: "Additional Feedback"
    Placeholder: "Please share any additional thoughts or suggestions..."
    Style: "Paragraph" # Short, Paragraph
    Required: false
    MaxLength: 1000
```

{% endcode %}

#### Button Settings

* **Placeholder** → The button text in closure DMs
* **ButtonEmoji** → Emoji shown on the button
* **ButtonStyle** → Button color (Primary=blue, Secondary=gray, etc.)

#### Questions

* You can add up to **4 questions** (Discord’s modal limit).
* Each question has:
  * **ID** → Unique name (used in logs/database)
  * **Label** → The question text
  * **Description** → Helper text shown under the label
  * **Options** → The ratings (with label, value, emoji)

#### Feedback Input

* Optional text box where users can write suggestions or comments.
* Choose **Short** (single line) or **Paragraph** (multi-line).

#### How it Works

1. User closes a ticket → receives a DM with the **Leave a Review** button.
2. Clicking opens a modal with rating questions (and optional feedback).
3. Ratings + comments are saved.
4. Review data is added to ticket logs, so you can track quality and performance.

***

### Common Issues

* **Tickets not created** → Check `Enabled: true`, valid `CategoryID`, and `MaxTickets`.
* **Support roles can’t see tickets** → Bot role must be **above** support roles in hierarchy.
* **Working hours not working** → Check timezone and 24h format.
