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

# Lifecycle & Automation

> Understand how tickets flow through their lifecycle and how automation keeps things clean.

## Ticket Flow

Every ticket moves through a defined set of lifecycle states. Each state transition can trigger messages, permission changes, and automation.

***

## Lifecycle Actions

<AccordionGroup>
  <Accordion title="1. Open">
    Triggered when a user clicks a panel button or selects a dropdown option.

    * A ticket channel is created in the configured category.
    * Channel permissions are set: the creator and support/trainee roles get access; everyone else is hidden.
    * The greeting message is sent. If a greeting DM is configured, the creator is DMed.
    * If a form is attached, it is shown to the user first.
    * Inactivity and auto-close timers start if configured.
  </Accordion>

  <Accordion title="2. Claim">
    Triggered by staff clicking **Claim** or running `.tickets claim`.

    * The claimer is recorded.
    * Channel permissions narrow to: claimer + creator only (unless `Keep Staff Visible On Claim` is enabled).
    * If a claim rename template is set, the channel is renamed.
    * If a claim category is set, the channel is moved.
    * The claim message is sent.
  </Accordion>

  <Accordion title="3. Unclaim">
    Triggered by running `.tickets unclaim`.

    * The claim is cleared.
    * Channel permissions are restored to the normal open state (creator + support + trainee roles).
    * Manual allow entries are preserved.
  </Accordion>

  <Accordion title="4. Move">
    Triggered by running `.tickets move <panel>`.

    * The ticket's panel association is updated.
    * The channel is moved to the new panel's category.
    * The move message is sent.
  </Accordion>

  <Accordion title="5. Close">
    Triggered by clicking **Close**, running `.tickets close`, or auto-close.

    * The ticket status is set to `closed`.
    * Channel permissions are updated: the creator is hidden, staff retain access.
    * Manual allow entries are suspended.
    * A transcript is generated and sent to the log channel.
    * If a close rename template is configured, the channel is renamed.
    * If a close category is configured, the channel is moved.
    * The close message is sent.
    * If an auto-delete timer is set, the auto-delete countdown begins.
  </Accordion>

  <Accordion title="6. Reopen">
    Triggered by clicking **Reopen** or running `.tickets reopen`.

    * The ticket status is set back to `open`.
    * Channel permissions are restored to the normal open state.
    * Manual allow entries are restored.
    * The reopen message is sent.
    * If a reopen DM is configured, the creator is DMed.
  </Accordion>

  <Accordion title="7. Delete">
    Triggered by clicking **Delete** or running `.tickets delete`.

    * A confirmation prompt is always shown first.
    * The ticket channel is deleted.
    * A transcript is generated and sent to the log channel if not already sent.
    * The ticket status is marked as `deleted`.
  </Accordion>
</AccordionGroup>

***

## Automation

Set automation at the option level to keep channels clean without manual intervention.

<AccordionGroup>
  <Accordion title="Inactivity Reminder">
    Sends a warning message in the ticket after a set period of no response from the ticket creator. The timer resets each time the creator sends a message.

    Configured via **Inactivity Timer** in the option's automation settings.
  </Accordion>

  <Accordion title="Auto-Close">
    Automatically closes the ticket after the inactivity warning has been sent and the creator still hasn't responded.

    Configured via **Auto-Close Timer** in the option's automation settings.
  </Accordion>

  <Accordion title="Auto-Delete After Close">
    Automatically deletes the ticket channel a set amount of time after it is closed.

    Configured via **Auto-Delete Timer** in the option's automation settings.
  </Accordion>

  <Accordion title="Close On Leave">
    Automatically closes the ticket if the creator leaves the server. Uses the normal close flow; the documented reason will be `"Ticket creator left the server"`.

    Configured in the option's **Member Permissions** settings.
  </Accordion>
</AccordionGroup>

***

## Transcripts

Transcripts archive ticket message history as a text file and send it to the configured log channel.

The transcript system can:

* Generate a transcript on demand.
* Generate or refresh a transcript automatically when a ticket is closed.
* Generate or refresh a transcript automatically when a ticket is deleted, even without a log channel.
* Refresh an existing transcript for the same ticket.
* Fetch an existing saved transcript by case ID.

**Available access paths via commands:**

<CodeGroup>
  ```javascript Current ticket theme={null}
  .tickets transcript
  ```

  ```javascript Specific channel theme={null}
  .tickets transcript <#channel>
  ```

  ```javascript By case ID theme={null}
  .tickets transcript <case_id>
  ```
</CodeGroup>

<Info>
  Archived transcripts (from deleted tickets) can only be accessed by admins.
</Info>
