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

# Jail

> Restrict bad actors and keep your server clean with jar's jail system.

## Introduction

jar's jail system can be customized to your liking, allowing custom DMs and messages for the bad actor.

## Setting up a jail

To create a jail, you can start by running the `jail setup` command. This will create a **jail role**, a **jail channel** & a **jail log channel**.

<Frame caption="Demonstration of how the jail is setup" type="glass">
  <img height="200" src="https://mintcdn.com/jarinc/A4GghNGPwdWr9LoP/images/security/jail/jail_setup.png?fit=max&auto=format&n=A4GghNGPwdWr9LoP&q=85&s=353a043329416134478d7265ba694370" data-path="images/security/jail/jail_setup.png" />
</Frame>

After the setup is complete, you should see 2 channels created: `#jar-jail` and `#jail-logs`.

<Frame caption="The 2 channels that jar created for the jail" type="glass">
  <img src="https://mintcdn.com/jarinc/A4GghNGPwdWr9LoP/images/security/jail/jail_channels.png?fit=max&auto=format&n=A4GghNGPwdWr9LoP&q=85&s=e674070b49cb975d8ef1578cc0aacce8" width="361" height="301" data-path="images/security/jail/jail_channels.png" />
</Frame>

* `#jar-jail` is what the bad actors will only see, restricting them from seeing any other channels.
* `#jail-logs` is where the actions taken against the bad actor will be logged.

## Customizing the jail

You can change the following settings for the jail.

<Tip>
  You can use jail specific variables for both jail message types.
  Check them out [here](/scripting/variables).
</Tip>

<AccordionGroup>
  <Accordion title="Jail channel">
    <Warning>It is **not recommended** to change the jail channel, as the provided channel has the correct permissions set up for the jail role.</Warning>
    The channel where the jail message will be sent, along with what the bad actor will see.

    <CodeGroup>
      ```javascript Syntax theme={null}
      jail channel <channel>
      ```

      ```javascript Example theme={null}
      ,,jail channel #prison-cell
      ```
    </CodeGroup>
  </Accordion>

  <Accordion title="Jail DM message">
    The message that the bad actor will receive when they are jailed.
    <Info>Leave the message blank to make jar send its default message.</Info>

    <CodeGroup>
      ```javascript Syntax theme={null}
      jail dm [message]
      ```

      ```javascript Example theme={null}
      ,,jail dm You have been jailed by {moderator.mention} for {reason}
      ```
    </CodeGroup>
  </Accordion>

  <Accordion title="Jail log channel">
    The channel where the jail actions are recorded.

    <CodeGroup>
      ```javascript Syntax theme={null}
      jail logs <channel>
      ```

      ```javascript Example theme={null}
      ,,jail logs #prison-logs
      ```
    </CodeGroup>
  </Accordion>

  <Accordion title="Jail message">
    The message that will be sent in the jail channel.
    <Info>Leave the message blank to make jar send its default message.</Info>

    <CodeGroup>
      ```javascript Syntax theme={null}
      jail message [message]
      ```

      ```javascript Example theme={null}
      ,,jail message {victim.mention} has been jailed by {moderator.mention} for {reason}
      ```
    </CodeGroup>
  </Accordion>

  <Accordion title="Jail role strip behaviour">
    The action you want jar to take when dealing with roles. If set to `On`, jar will remove all roles from the bad actor when they are jailed.

    <CodeGroup>
      ```javascript Syntax theme={null}
      jail strip <On/Off>
      ```

      ```javascript Example theme={null}
      ,,jail strip On
      ```
    </CodeGroup>
  </Accordion>
</AccordionGroup>

## Resetting the jail

To reset the jail, you can run the `jail reset` command.

jar will ask you to confirm the reset, followed by a confirmation message.

<Frame>
  <img src="https://mintcdn.com/jarinc/A4GghNGPwdWr9LoP/images/security/jail/jail_reset_ask.png?fit=max&auto=format&n=A4GghNGPwdWr9LoP&q=85&s=a6bd26bc70114514629f2dd79c8a3966" width="834" height="335" data-path="images/security/jail/jail_reset_ask.png" />
</Frame>

Pressing **Yes** will reset the jail, and you will see this confirmation message.

<Frame>
  <img src="https://mintcdn.com/jarinc/A4GghNGPwdWr9LoP/images/security/jail/jail_reset_yes.png?fit=max&auto=format&n=A4GghNGPwdWr9LoP&q=85&s=bf163f14e434854ca4bc8464b91a8cf3" width="575" height="328" data-path="images/security/jail/jail_reset_yes.png" />
</Frame>

Pressing **No** will cancel the reset, and you will see this message.

<Frame>
  <img src="https://mintcdn.com/jarinc/A4GghNGPwdWr9LoP/images/security/jail/jail_reset_no.png?fit=max&auto=format&n=A4GghNGPwdWr9LoP&q=85&s=d1a98d563e2d7b923acb3bbc25756e40" width="482" height="337" data-path="images/security/jail/jail_reset_no.png" />
</Frame>
