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

# Identity Roles

> Reward members who represent your server with its tag.

## Overview

Discord's server tags let members display a small badge next to their name showing which server they represent. Identity tracking watches for that — when someone sets your server as their tag, confine can hand them a role automatically and strip it back off if they switch to a different server.

<Warning>
  Your server needs **Server Tags** unlocked before any of this works. Without that feature, confine will stop you at the first command.
</Warning>

<Info>
  Every command here requires the **Manage Server** permission.
</Info>

## Turning it on

```javascript theme={null}
,identity mode on
```

Switch it back off with `,identity mode off`. Nothing else on this page takes effect until tracking is enabled.

## Roles

Any role you register here gets applied to members displaying your tag, and removed from members who aren't.

<CodeGroup>
  ```javascript Syntax theme={null}
  ,identity role add (role)
  ```

  ```javascript Example theme={null}
  ,identity role add @Tagged
  ```
</CodeGroup>

Dropping a role from tracking works the same way:

<CodeGroup>
  ```javascript Syntax theme={null}
  ,identity role remove (role)
  ```

  ```javascript Example theme={null}
  ,identity role remove @Tagged
  ```
</CodeGroup>

<Info>
  Bot-managed and integration roles can't be used — confine will reject them.
</Info>

### Reviewing and clearing

`,identity role list` pages through everything currently registered.

`,identity role reset` wipes the list entirely. You'll get a confirmation prompt with buttons that only responds to whoever ran it and expires after 30 seconds.

## Log channel

Point confine at a channel and it'll post there whenever someone picks up or drops your tag.

<CodeGroup>
  ```javascript Syntax theme={null}
  ,identity channel (channel)
  ```

  ```javascript Example theme={null}
  ,identity channel #identity
  ```
</CodeGroup>

## Customizing the message

<CodeGroup>
  ```javascript Syntax theme={null}
  ,identity message (message)
  ```

  ```javascript Example theme={null}
  ,identity message {user} {state} the server tag `{tag}`
  ```
</CodeGroup>

Confine validates your message before saving it — if the syntax produces nothing usable, you'll get an error instead of a silently broken log channel. Full embed syntax works here, so starting your message with `{embed}` builds a rich embed rather than plain text.

Run `,identity message view` to see the raw code behind your current message.

### Variables

| Variable     | Resolves to                              |
| ------------ | ---------------------------------------- |
| `{user}`     | Mention of the member                    |
| `{username}` | Their username                           |
| `{state}`    | Whether they enabled or disabled the tag |
| `{tag}`      | The server tag itself                    |
| `{old_tag}`  | The tag they were displaying before      |
| `{badge}`    | The badge identifier                     |
| `{guild}`    | Your server's name                       |
| `{guild_id}` | Your server's ID                         |

## Syncing existing members

Identity tracking only reacts to changes as they happen, so members who already had your tag set before you turned it on won't have roles yet.

```javascript theme={null}
,identity sync
```

This sweeps every member in the server, applies your identity roles to anyone currently displaying your tag, removes them from anyone who isn't, and reports back what changed.

<Tip>
  Run this once right after your initial setup, and again any time you add a new role to the list.
</Tip>
