# Autorole and verification

Source: https://righteousbot.dev/docs/features/autorole-and-verification/

Roles handed out on join, roles restored on rejoin, and a verify button members click themselves.

Three systems can give a member a role without a moderator: **autorole** on join, **role history** when
they come back, and **verification** when they click a button. For roles members pick themselves, see
[reaction roles](/docs/features/reaction-roles/).

## Give roles to every new member [#give-roles-to-every-new-member]

[`,autorole`](/commands/server-tools/autorole/#autorole-add) needs **Manage Roles**. Every role on the
list is added to every new member, and each role must sit below the bot's highest role.

<CommandBlock syntax=",autorole add <role>" example=",autorole add @Member" />

| Command                                                                       | Does                              |
| ----------------------------------------------------------------------------- | --------------------------------- |
| [`,autorole remove <role>`](/commands/server-tools/autorole/#autorole-remove) | Takes one role off the list       |
| [`,autorole list`](/commands/server-tools/autorole/#autorole-list)            | Shows the list                    |
| [`,autorole clear`](/commands/server-tools/autorole/#autorole-clear)          | Empties it, with no per-role undo |

## Restore roles when someone rejoins [#restore-roles-when-someone-rejoins]

[`,autorole history`](/commands/server-tools/autorole/#autorole-history) gives a returning member back the
roles they left with, if they rejoin inside a window. It's off by default and **free on every tier**.
Autorole only fires on a first join.

<CommandBlock syntax=",autorole history [on|off]" example=",autorole history on" />

<CommandBlock syntax=",autorole history duration <value>" example=",autorole history duration 2h" />

|                | Free         | Server Premium |
| -------------- | ------------ | -------------- |
| Longest window | **12 hours** | **48 hours**   |

The window needs a unit (`45m`, `2h`, `1d`). A bare number, or a value over your ceiling, is refused, and
turning it on without a duration gives 12 hours. If Server Premium lapses, your stored 48 hours is kept but
served as 12 until it returns; the bare command shows the window actually in effect. Roles that were deleted
or moved above the bot while the member was away are skipped.

## Let members verify themselves [#let-members-verify-themselves]

[`,verification`](/commands/server-tools/verification/#verification-setup) posts a button that gives the
clicker one role. It needs **Manage Server** and is **prefix-only**: there is no `/verification`.

<CommandBlock syntax=",verification setup" />

<DiscordEmbed caption="The card setup posts in `#verify`. Clicking the button gives the member the Verified role." color="#2F3136" title="Welcome to Righteous" description="Press the button below to verify yourself and get access to the server." rows="[[{ label: &#x22;Verify&#x22;, style: &#x22;success&#x22; }]]" />

This creates a `#verify` channel, a **Verified** role with no permissions, and a Verify button, and
touches nothing that exists. It does **not** hide anything on its own: deny **View Channel** for
`@everyone` and allow it for the new role wherever you want verification to gate.

| Command                                                                                                         | Does                                                                                                                                             |
| --------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
| [`,verification role [role]`](/commands/server-tools/verification/#verification-role)                           | Reuses a different role; bare, it recreates a deleted one                                                                                        |
| [`,verification update`](/commands/server-tools/verification/#verification-update)                              | Repairs a missing button, channel permissions or role, and says what it changed. A deleted **channel** isn't recreated: use `reset` then `setup` |
| [`,verification config`](/commands/server-tools/verification/#verification-config)                              | Shows the settings                                                                                                                               |
| [`,verification button <message link> [button text]`](/commands/server-tools/verification/#verification-button) | Adds the button to a message you already posted                                                                                                  |
| [`,verification reset`](/commands/server-tools/verification/#verification-reset)                                | Disconnects verification and leaves the role and channel in place                                                                                |

<Callout type="warn" title="A role with powerful permissions is refused, twice">
  A role with Administrator, Manage Server, Manage Roles, Ban or Kick is refused when you set it, and
  checked again on **every click** against its current permissions, since an admin can edit the role later.
</Callout>

## When someone joins [#when-someone-joins]

Containment runs first: a mute, jail or timeout the member left with is **re-applied** if it's still owed,
and then role history and autorole are both **skipped**, so a punishment can't be outrun. A clean rejoiner
gets role history, then autorole, then the welcome tail on
[server messages](/docs/features/server-messages/). A punishment that expired while they were away is not
re-applied.

## Common issues [#common-issues]

**A returning member got old roles back unasked.** That's role history. Turn it off with
`,autorole history off`.

**A returning member was muted again and got no old roles.** Their punishment was still active when they
left, so containment ran and skipped the rest.

**Autorole didn't apply a role.** The role sits above the bot's highest role. Discord refuses it, so move
the bot's role up.

**Verification refuses my role.** It carries a dangerous permission, at setup or at click time. Pick a
role without one and set it again.

**The verify button says "This interaction failed."** Run `,verification update`.
