# Moderation <!-- {docsify-ignore-all} -->
Sapphire's <img src="https://dashboard.sapph.xyz/assets/item-icons/moderation.svg" alt="" style="vertical-align: middle; width: 16.5px;"> **Moderation** module is complex, highly customizable, and offers a wide range of commands.

The following page provides an **overview** of how Sapphire's **Moderation system works** at its core, what features it offers, and **how to configure** it through 
  <a href="https://dashboard.sapph.xyz/" target="_blank" rel="noopener noreferrer" style="color:#d3d3d3; text-decoration: underline;">
    Sapphire's dashboard</a>.
</p>

You can find a list of all moderation commands by filtering them in the **Commands** ➜ **Default Commands** section of Sapphire's dashboard.

## <img src="https://dashboard.sapph.xyz/assets/icons/folders.svg" alt="" style="vertical-align: middle; width: 27px;"> Cases <!-- {docsify-ignore} -->
Sapphire's Moderation system uses **cases** to **store punishment information**. Every ban, mute, kick or warn creates a case with a unique case ID. The **Cases** tab gives an overview of all cases on a server and allows filtering, mass editing and viewing each case in detail.

<div class="a-btn-list">
 <a href="/#/moderation/cases" class="btn external">Learn more about Cases</a>
</div>

## Role Commands <!-- {docsify-ignore} -->
The **Role commands** tab manages the commands `assignrole`, `removerole`, `createrole` and `editrole`. Conditions can allow users without the "Manage roles" permission to use these commands.

<div class="a-btn-list">
 <a href="/#/moderation/role-commands" class="btn external">Learn more about Role Commands</a>
</div>

## User Reports
User Reports is a Moderation feature that allows users to submit reports about other users, with customizable options for moderators to handle and manage those reports.

When a report is created, it sends a message to a selected channel containing report details and action buttons. Moderators can accept or ignore reports, and take actions like executing commands, opening moderation cases, or deleting messages.

<div class="a-btn-list">
 <a href="/#/guides/user-reports" class="btn external">Learn more about User Reports</a>
</div>

## Punish Settings <!-- {docsify-ignore} -->
The **Punish Settings** tab controls what happens when users are banned, kicked, muted or warned, e.g. default reasons and durations, actions on punish, forced reasons, timeouts and how punishment commands behave.

<div class="a-btn-list">
 <a href="/#/moderation/punish-settings" class="btn external">Learn more about Punish Settings</a>
</div>

## Immune Roles <!-- {docsify-ignore} -->
**Immune roles** cannot be punished with Sapphire. Roles can be immune to all or only specific punishment types, or immunity can be based on the role hierarchy.

<div class="a-btn-list">
 <a href="/#/moderation/immune-roles" class="btn external">Learn more about Immune Roles</a>
</div>

## User Notifications <!-- {docsify-ignore} -->
Choose whether users receive a direct message from Sapphire when they are punished or unpunished, including punishments by other users or bots.

<div class="a-btn-list">
 <a href="/#/moderation/user-notifications" class="btn external">Learn more about User Notifications</a>
</div>

## Predefined Reasons <!-- {docsify-ignore} -->
**Predefined Reasons** are pre-configured punishment reasons that can be used with short aliases in commands.

<div class="a-btn-list">
 <a href="/#/moderation/predefined-reasons" class="btn external">Learn more about Predefined Reasons</a>
</div>

## Channel Locking <!-- {docsify-ignore} -->
Lock and unlock channels with the `lock`, `unlock`, `lockall` and `unlockall` commands. This tab configures ignored roles and the channels locked by `lockall`.

<div class="a-btn-list">
 <a href="/#/moderation/channel-locking" class="btn external">Learn more about Channel Locking</a>
</div>

## Privacy <!-- {docsify-ignore} -->
The **Privacy** tab configures which case information (e.g. proof, verified proof, author) is visible in command output messages and direct messages.

<div class="a-btn-list">
 <a href="/#/moderation/privacy" class="btn external">Learn more about Privacy</a>
</div>

## Purge pinned messages
Choose whether **pinned messages** in a channel should be **deleted** when using the `purge` command.

## Commands overview
<p style="font-size: 0.8em; color: #9e969a;">
  This feature can also be set up and managed via 
  <a href="https://dashboard.sapph.xyz/" target="_blank" rel="noopener noreferrer" style="color: #9e969a; text-decoration: underline;">
    Sapphire's dashboard
  </a>.
</p>

### Create punishments
| Command | Description | Usage |
| --- | --- | --- |
| ban | Bans a user from the guild.<br>Add -r to review the punishment within a modal.| ban [user] [duration] [reason] [-r] |
| kick | Kicks a user from the guild.<br>Add -r to review the punishment within a modal. | kick [user] [reason] [-r]
| mute | Mutes a user.<br>Add -r to review the punishment within a modal. | mute [user] [duration] [reason] [-r] |
| warn | Warns a user.<br>Add -r to review the punishment within a modal. | warn [user] [duration] [reason] [-r] |
| massban | Bans multiple users at once - time and reason can be set after execution. | massban <user1> [user2] ... |
| masskick | Kicks multiple users at once - reason can be set after execution. | masskick <user1> [user2] ... |
| massmute | Mutes multiple users at once - time and reason can be set after execution. | massmute <user1> [user2] ... |
| masswarn | Warns multiple users at once - time and reason can be set after execution. | masswarn <user1> [user2] ... |
| nameban | Bans all users having &lt;name&gt; in their user- or nickname - time and reason can be set after execution. Add -f to search a member's full name (instead of just the beginning of a member's name). | nameban &lt;name&gt; [-f] |
| namekick | Kicks all users having &lt;name&gt; in their user- or nickname - reason can be set after execution. Add -f to search a member's full name (instead of just the beginning of a member's name). | namekick &lt;name&gt; [-f] |
| namemute | Mutes all users having &lt;name&gt; in their user- or nickname - time and reason can be set after execution. Add -f to search a member's full name (instead of just the beginning of a member's name). | namemute &lt;name&gt; [-f] |
| namewarn | Warns all users having &lt;name&gt; in their user- or nickname - time and reason can be set after execution. Add -f to search a member's full name (instead of just the beginning of a member's name). | namewarn &lt;name&gt; [-f] |
| timeban | Bans all users who either created their account &lt;time ago&gt;, or joined &lt;time ago&gt; for [duration] and [reason]. | timeban <created\|joined> &lt;time ago&gt; [duration] [reason] |
| timekick | Kicks all users who either created their account <time ago>, or joined &lt;time ago&gt; for [reason]. | timekick <created\|joined> &lt;time ago&gt; [reason] |
| timemute | Mutes all users who either created their account &lt;time ago&gt;, or joined &lt;time ago&gt; for [duration] and [reason]. | timemute <created\|joined> &lt;time ago&gt; [duration] [reason] |
| timewarn | Warns all users who either created their account &lt;time ago&gt;, or joined &lt;time ago&gt; for [reason]. | timewarn <created\|joined> &lt;time ago&gt; [reason] |

### Undo punishments
| Command | Description | Usage |
| --- | --- | --- |
| unban | Unbans a user from the guild. | unban <user> [reason] |
| unmute | Closes all mutes from a user. | unmute <user> [reason] |
| unwarn | Closes all warns from a user. | unwarn <user> |

### Manage punishment cases
| Command | Description | Usage |
| --- | --- | --- |
| casedelete | Deletes a case. | casedelete <case id> |
| caseinfo | Displays information about a case. | caseinfo [case id] |
| caselist | Displays a list of the newest cases (including the specified users). | caselist [user] [user]
| caseupdate | Updates a specific case. | caseupdate [case id] [reason\|time [reason]] |
| caseclose | Closes a specific case. | caseclose <case id> [reason] |
| setproof | Sets the proof for a case. | setproof [case id] <proof> |

### Channel moderation
| Command | Description | Usage |
| --- | --- | --- |
| lock | Lock a text or voice channel. When locking a voice channel, all connected users will be kicked from it. Add +v or +t (or +vt) at the end to revoke view or thread permissions, too. Add +s or (+vts) to silently lock the channel without an info message. | lock [channel] [reason] [+(v\|t\|s)] |
| lockall | Locks all channels set in the dashboard. Add +v or +t (or +vt) at the end to revoke view or thread permissions, too. Add +s or (+vs) to silently lock the channels without an info message. | lockall [reason] [+(v\|t\|s)] |
| unlock | Unlock a text or voice channel. Add +s at the end to silently unlock the channel without an info message. | unlock [channel] [reason] [+s] |
| unlockall | Unlock all locked channels. Add +l at the end to only unlock channels locked with lockall. Add +s at the end to silently unlock the channels without an info message. | unlockall [reason] [+l\|s] |
| purge | Deletes either<br>- the last `<count>` messages, or<br>- the last messages `<time>` ago, or<br>- all messages until `<message>`<br>- all messages between `<message1>` and `<message2>`.<br><br>Optionally only deletes messages from `[user]`. | purge <count\|time\|message url/id> [between second message url/id\|user] [user] |
| setslowmode | Sets the slowmode for a channel. | setslowmode [channel] <time> |

### User information
| Command | Description | Usage |
| --- | --- | --- |
| userinfo | Gets information about a user. | userinfo [user] |
| roleinfo | Gets information about all roles / a specifc role. | roleinfo [role] |
| warns | Gets all warns about a user. | warns [user] |
| usernotes | Gets all notes about a user or adds one. | usernotes <user> [note to add] |

### Moderation: User Reports
| Command | Description | Usage |
| --- | --- | --- |
| report | Report a user to the server's moderation team. | report <user\|message url> <reason> [comment] |
| report-blacklist | Block users from using the report command. | report-blacklist <show\|add\|remove> [user id] |
| report-ignoreall | Ignore all open reports in your server at once without notifying reporters. | report-ignoreall |
| report-sendmissing | Report info messages are not supposed to be deleted. Execute this command to bring back deleted report messages. | report-sendmissing |

### Miscellaneous
| Command | Description | Usage |
| --- | --- | --- |
| linkcaseview | Links this server's case view with another server, so both servers can view each other's moderation cases.
| predefinedreasons | Manage predefined reasons for Moderation punishments. | predefinedreasons |

### Role commands
| Command | Description | Usage |
| --- | --- | --- |
| assignrole | Assigns one or multiple roles to one or multiple users. | assignrole <role1 \| role2 \| ...> <user1 \| user2 \| ...> [reason] |
| removerole | Removes one or multiple roles from one or multiple users. | removerole <role1 \| role2 \| ...> <user1 \| user2 \| ...> [reason] |
| createrole | Creates a new role. Options can be set after execution. | createrole |
| editrole | Edits an existing role. | editrole \<role> |