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

# Jail System

> Isolate and manage problematic users with Veronica's advanced Jail system.

# Jail System

The Jail system is a high-security isolation utility designed to temporarily restrict a user's access to your server without resorting to a kick or ban. When a member is jailed, Veronica creates a secure backup of their roles, strips them of all permissions, and confines them to a dedicated `#jail` channel where they can communicate only with authorized staff.

### Role Safety Guard (NEW)

The jail system includes a security guard to prevent privilege escalation.

<Warning>
  If the `Jailed` role is granted any "Dangerous Permissions" (e.g., Administrator, Manage Server, Manage Roles), the bot will **refuse** to jail any user. This prevents hackers from being accidentally given elevated powers while "jailed".
</Warning>

<Info>
  Veronica provides full support for both **Slash Commands** and **Prefix Commands** across the entire Jail suite.
</Info>

## Getting Started

Before you can use the jail system, you must initialize the server's infrastructure to ensure roles and permissions are correctly configured.

<Steps title="Infrastructure Deployment Workflow">
  <Step title="Initialize Infrastructure">
    Run the setup command to automatically generate the required role and channel environment.

    <CodeGroup>
      ```bash Slash theme={null}
      /jailsetup
      ```

      ```bash Prefix theme={null}
      ,jailsetup
      ```
    </CodeGroup>

    <Check>Jail role and #jail channel successfully created.</Check>
  </Step>

  <Step title="Automated Configuration">
    Veronica will update channel permissions server-wide.
    <Check>Channel overrides synchronized for the Jailed role.</Check>
  </Step>

  <Step title="Permission Hierarchy">
    Ensure the bot's highest role is positioned **above** the "Jailed" role.
    <Check>Bot hierarchy verified for role management.</Check>
  </Step>
</Steps>

## Next Steps

<CardGroup cols={2}>
  <Card title="Logging" icon="clipboard-list" href="/configuration/logging">
    Track every jail and unjail action in your moderation logs.
  </Card>

  <Card title="Auto-Mod" icon="shield-check" href="/setups/automod">
    Automate the jailing of repeat offenders using the escalation system.
  </Card>
</CardGroup>

## Command Reference

Efficiently manage jailed users using our dual-input command system.

<CodeGroup>
  ```bash Jail theme={null}
  # Slash
  /jail user:@Member reason:Rule Violation

  # Prefix
  ,jail <@Member|ID> [reason]
  ```

  ```bash Unjail theme={null}
  # Slash
  /unjail user:@Member

  # Prefix
  ,unjail <@Member|ID>
  ```

  ```bash List theme={null}
  # Slash
  /jaillist

  # Prefix
  ,jaillist
  ```

  ```bash Setup theme={null}
  # Slash
  /jailsetup

  # Prefix
  ,jailsetup
  ```
</CodeGroup>

### Command Details

| Command     | Permission         | Description                                                    |
| :---------- | :----------------- | :------------------------------------------------------------- |
| `jail`      | `Moderate Members` | Strips roles and restricts the user to the jail channel.       |
| `unjail`    | `Moderate Members` | Removes the jail status and restores all original roles.       |
| `jaillist`  | `Staff`            | Displays a list of all currently jailed members in the server. |
| `jailsetup` | `Administrator`    | Configures the server-wide jail role and channel architecture. |

## Core Mechanics

Understanding how Veronica handles your server's security is key to effective moderation.

<CardGroup cols={2}>
  <Card title="Role Persistence" icon="database">
    Before any roles are removed, Veronica saves a snapshot of the user's role IDs to the database, ensuring 100% accurate restoration.
  </Card>

  <Card title="Staff Interactivity" icon="hand-pointer">
    The Jail command generates an interactive **Unjail** button, allowing staff to quickly restore a user with a single click.
  </Card>

  <Card title="Hierarchy Safety" icon="shield">
    Moderators are prevented from jailing users with higher or equal role positions, maintaining the chain of command.
  </Card>

  <Card title="Isolation Logic" icon="lock">
    The "Jailed" role overwrites channel permissions server-wide, effectively "ghosting" the user from the community.
  </Card>
</CardGroup>

### User Persistence

<Note>
  If a user leaves and rejoins the server while jailed, their status remains stored in the database. You can use the registry to track these users and ensure they cannot bypass their isolation by re-joining.
</Note>

## Advanced Flow

```mermaid theme={null}
graph TD
    A[Moderator executes Jail] --> B{Verify Hierarchy}
    B -->|Authorized| C(Backup Current Roles)
    B -->|Denied| X[Error: Permission Denied]
    C --> D(Strip All Member Roles)
    D --> E(Assign Jailed Role)
    E --> F[User Isolated in #jail]
    F --> G{Unjail Triggered}
    G --> H(Remove Jailed Role)
    H --> I(Restore Role Snapshot)
    I --> J[User Fully Restored]
```

<Warning>
  **Pro-Tip:** Do not manually delete the **Jailed** role or **#jail** channel. If the system is tampered with, run `jailsetup` again to immediately repair and re-sync the configuration.
</Warning>
