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

# Cases & history

> Every moderation action gets a number, a reason you can edit, and a permanent record.

Every punishment creates a **case** — a numbered record with the target, the moderator, the action, the reason and a timestamp. Cases are what turn "I think we banned that guy once" into something you can actually check.

## Looking up a case

```javascript theme={null}
!case 47
```

Requires **Manage Messages**. Shows the full record and links to the mod-log message if one exists.

## Editing a reason

```javascript theme={null}
!case reason 47 coordinated raid — 3 alt accounts confirmed
```

Updates the case **and** edits the original mod-log message, so the log stays accurate rather than showing whatever got typed in a hurry.

`!reason 47 <text>` is the shortcut for the same thing.

## Deleting a case

```javascript theme={null}
!case delete 47
```

Removes the case and deletes its mod-log message. Use it for genuine mistakes — a mis-typed target, a duplicate action — not to hide things from other staff.

## A member's history

<CodeGroup>
  ```javascript Everything theme={null}
  !history @someone
  ```

  ```javascript Just the breakdown theme={null}
  !history statistics @someone
  ```

  ```javascript Wipe it theme={null}
  !history clear @someone
  ```
</CodeGroup>

`history` (aliases `mod`, `moderation`, `his`) pages through every case against a member, newest first. `statistics` (aliases `stats`, `stat`) gives the summary — how many bans, kicks, mutes, warns, and when the most recent was.

<Warning>
  `history clear` is permanent and removes every case against that user. It does not reset their warning count for [threshold](/moderation/warnings#thresholds) purposes — that's `!warn reset @someone`.
</Warning>

## A moderator's history

```javascript theme={null}
!history moderator @jake
!history moderator statistics @jake
```

Every action a specific moderator has taken, and the breakdown by type. `!moderationhistory @jake` (aliases `modhistory`, `mhistory`, `modh`, `mh`) is the standalone shortcut.

<Tip>
  Worth running occasionally. Wildly uneven numbers across a staff team usually mean either someone isn't doing anything, or someone's doing too much of it.
</Tip>

## Reason templates

Save the reasons you type constantly and use their name instead:

<CodeGroup>
  ```javascript Create one theme={null}
  !reason create raid coordinated raid participation
  ```

  ```javascript Use it theme={null}
  !ban @someone raid
  ```

  ```javascript List them theme={null}
  !reason list
  ```

  ```javascript Delete one theme={null}
  !reason delete raid
  ```
</CodeGroup>

Templates work as the reason argument on any moderation command. Beyond saving typing, they keep the wording identical across your whole team, which matters when someone reads the log back six months later.

## Custom responses

`invoke` overrides what mira replies with after a moderation command, and what the punished member gets in their DM. Requires **Manage Server**.

<CodeGroup>
  ```javascript Channel response theme={null}
  !invoke ban {content: {user.name} is gone — case #{case}}
  ```

  ```javascript DM to the member theme={null}
  !invoke dm ban {title: Banned from {guild.name}} {description: {reason}} {color: #ef767a}
  ```

  ```javascript Preview theme={null}
  !invoke view ban
  !invoke dm view ban
  ```

  ```javascript Remove theme={null}
  !invoke remove ban
  !invoke dm remove ban
  ```
</CodeGroup>

### Variables

| Variable      | Value                     |
| ------------- | ------------------------- |
| `{user}`      | The member being punished |
| `{moderator}` | Who ran the command       |
| `{reason}`    | The reason given          |
| `{case}`      | The case number           |
| `{duration}`  | For temporary punishments |

Plus all the standard [variables](/scripting/variables). `!invoke variables` lists them in Discord.

Responses are full [scripts](/scripting/overview), so embeds, containers and buttons all work:

```javascript theme={null}
!invoke dm ban {box: #ef767a} {box.header: You were banned from {guild.name}} {box.text: **Reason:** {reason}
**Case:** #{case}} {box.button: label: "Appeal" url: "https://example.com/appeal" style: "link"}
```

<CodeGroup>
  ```javascript See everything configured theme={null}
  !invoke list
  !invoke dm list
  ```

  ```javascript Wipe them all theme={null}
  !invoke clear
  !invoke dm clear
  ```
</CodeGroup>

## Where cases get logged

Case messages go to whichever channel has the `moderation` log event enabled:

```javascript theme={null}
!logging enable #mod-logs moderation
```

Without it, cases are still recorded and `!case` still works — you just don't get a live feed. Most servers want one. See [Logging](/setup/logging).

## Command reference

| Command                              | Aliases                    | Permission      | Description                |
| ------------------------------------ | -------------------------- | --------------- | -------------------------- |
| `case <id>`                          | —                          | Manage Messages | View a case                |
| `case reason <id> <text>`            | —                          | Manage Messages | Edit a reason              |
| `case delete <id>`                   | `del`, `remove`            | Manage Messages | Delete a case              |
| `reason <id> <text>`                 | `template`, `tmpl`         | Manage Messages | Shortcut for `case reason` |
| `reason create <name> <text>`        | `add`, `new`               | Manage Messages | Save a template            |
| `reason delete <name>`               | `del`, `remove`            | Manage Messages | Delete a template          |
| `reason list`                        | `ls`, `show`, `view`       | Manage Messages | View templates             |
| `history <user>`                     | `mod`, `moderation`, `his` | Manage Messages | Cases against a member     |
| `history statistics <user>`          | `stats`, `stat`            | Manage Messages | Breakdown by type          |
| `history clear <user>`               | `wipe`, `purge`            | Manage Messages | Delete their cases         |
| `history moderator <mod>`            | `moderation`, `mod`        | Manage Messages | Cases a mod has issued     |
| `history moderator statistics <mod>` | `stats`                    | Manage Messages | A mod's breakdown          |
| `invoke <command> <script>`          | —                          | Manage Server   | Custom channel response    |
| `invoke dm <command> <script>`       | `pm`, `private`            | Manage Server   | Custom DM response         |
| `invoke view <command>`              | `show`, `preview`          | Manage Server   | Preview a response         |
| `invoke list`                        | `ls`                       | Manage Server   | All custom responses       |
| `invoke remove <command>`            | `delete`, `off`            | Manage Server   | Remove one                 |
| `invoke clear`                       | `reset`, `purge`           | Manage Server   | Remove all                 |
| `invoke variables`                   | `vars`, `var`, `v`         | Manage Server   | List available variables   |
