> From the BotGhost docs: https://botghost.com/docs/server-management/auto-roles
> Every page: https://botghost.com/docs/llms.txt

# Auto Roles

Your bot gives roles when members join, gives returning members their roles back, and gives or takes roles after a while. Free for every bot.

Auto Roles gives roles by itself. New members and bots get the roles you pick when they join. Someone who leaves and comes back gets the roles they had. A timed role can come or go after a member has been in the server for a while, such as a **New account** role taken away after 3 days.

Staff roles never come back by themselves. The bot holds them back, names them in the log, and a staff member decides.

Auto Roles replaces Sticky Roles. It's free for every bot. There's no Premium part, and its runs, variables, and stored values don't count toward your free limits.

![The Auto Roles page on the Join roles tab, with the Roles when someone joins card, the New accounts card, and a Discord preview beside them](https://botghost.com/docs/content/assets/workspace/auto-roles-join.png)

*The Join roles tab*

- **A** The five tabs: **Join roles**, **Returning members**, **Timed roles**, **Safety**, and **Log**.
- **B** **Roles for people** and **Roles for bots**.
- **C** **Wait until they pass the rules screening** and **Wait first**.
- **D** The **New accounts** card.
- **E** The preview shows how the open tab looks in Discord.

## Before you start

You need:

- Your bot in your Discord server. See [Invite Your Bot](https://botghost.com/docs/getting-started/invite-your-bot) if it isn't yet.
- **Manage Roles** for your bot. It can't give or take any role without it.
- Your bot's own role above every role it gives. In Discord, open **Server Settings**, then **Roles**, and drag your bot's role higher.
- **View Audit Log** for your bot, so it can tell a kick or ban from someone leaving. Without it, kicked members get their roles back like anyone else.
- **Manage Nicknames** for your bot, but only if you turn on **Nicknames come back**.

## Setup

### Step 1: Turn on Auto Roles

Open **Auto Roles** in your bot's dashboard and press **Enable** at the top right. It adds the Auto Roles events, the `/roles` command, and the custom variables that hold its settings.

![The top of the Auto Roles page with the Docs link, the server menu set to Ghost Hangout, Reset to Default and Enabled, and the Get started strip with its four steps](https://botghost.com/docs/content/assets/workspace/auto-roles-header.png)

- **A** **Enabled** shows the module is on. Before you turn it on, this says **Enable**.
- **B** The server menu picks whose settings you're changing.
- **C** **Reset to Default**. See [Each server's own settings](https://botghost.com/docs/server-management/auto-roles#each-servers-own-settings).
- **D** **Docs** opens this page.
- **E** The **Get started** strip with its steps and **Remember now**.

If Sticky Roles (old) is on, the page shows a strip to move it across. See [Moving from Sticky Roles](https://botghost.com/docs/server-management/auto-roles#moving-from-sticky-roles).

### Step 2: Pick your server

Use the server menu at the top of the page. Each server has its own roles, settings, and messages.

### Step 3: Pick the roles to give

On the **Join roles** tab, pick **Roles for people**. If you only want roles to come back for returning members, leave this empty and keep **Give roles back** on, on the **Returning members** tab.

The **Get started** strip shows four steps: **Roles to give**, **Bot's role above them**, **Log channel**, and **Everyone's roles remembered**. Click a step to jump to its tab. When all four are done, it says **You're set**.

### Step 4: Check the bot's role

Open the **Safety** tab. **Roles the bot can't reach** lists any role your bot can't give, and why. See [Roles the bot can't reach](https://botghost.com/docs/server-management/auto-roles#roles-the-bot-cant-reach).

### Step 5: Pick a log channel

On the **Log** tab, pick a channel only staff can see. The bot posts there when roles come back and when roles couldn't be given.

### Step 6: Save

A bar pops up at the bottom of the page. Press **Save Changes**.

![The Unsaved changes bar with Save Changes marked](https://botghost.com/docs/content/assets/workspace/welcomer-save.png)

### Step 7: Remember everyone's roles

After saving, press **Remember now** on the **Get started** strip, then press it again to start. The bot copies the roles every member has now, so members who leave before their roles change still get them back. See [Keep a copy of everyone's roles](https://botghost.com/docs/server-management/auto-roles#keep-a-copy-of-everyones-roles).

## Each server's own settings

Auto Roles has no setting that covers every server, because roles and channels belong to one server. When you pick a server, you see and change that server's settings. To set up another server, pick it in the same menu.

**Reset to Default** takes two clicks. It puts every setting in the picked server back to how a new Auto Roles starts. The roles you picked, your timed roles, and the log channel stay.

**Disable** also takes two clicks. It turns Auto Roles off for the whole bot and keeps your settings.

## Join roles

The **Roles when someone joins** card sets what new members get. Returning members follow the [Returning members](https://botghost.com/docs/server-management/auto-roles#returning-members) tab.

- **Give roles when someone joins**: on to start with. When it's off, nobody gets a role for joining. Roles still come back for returning members.
- **Roles for people**: everyone who joins gets these.
- **Roles for bots**: bots get these instead of the roles for people.
- **Wait until they pass the rules screening**: on to start with. It only matters when your server uses Discord's rules screening or Onboarding. Members get their roles once they accept the rules, so nobody skips the rules by rejoining. Roles for returning members wait too.
- **Wait first**: how long the bot waits before it gives the join roles, up to 7 days. Leave it empty and roles come straight away. A wait under a minute counts as a minute. Someone who leaves before the wait ends gets nothing.

### New accounts

Use this card to give brand new Discord accounts a different role, such as one that can only read.

- **Treat new accounts differently**: off to start with. Accounts younger than the days you set get the role below instead of the roles for people.
- **Younger than**: 1 to 365 days. It starts at 7.
- **Give this role instead**: one role.

To take that role away after a few days, add a timed role on the [Timed roles](https://botghost.com/docs/server-management/auto-roles#timed-roles) tab.

## Returning members

When someone leaves, the bot remembers their roles. If they come back in time, they get them back.

![The Returning members tab with the Roles back for returning members, Always give back, and How long roles are kept cards](https://botghost.com/docs/content/assets/workspace/auto-roles-returning.png)

*The Returning members tab*

- **A** **Give roles back** and **Which roles**.
- **B** The roles to leave out, or the only roles to give back.
- **C** **Always give back, even after a kick or ban**.
- **D** **After a kick or ban**.
- **E** **Remember for**.

The **Roles back for returning members** card has these settings:

- **Give roles back**: on to start with. When it's off, nothing comes back except the always roles.
- **Which roles**: **All of them except the ones below** (to start with) or **Only the ones below**.
- **Roles to leave out**: shows with **All of them except the ones below**. Leave it empty and every role they had comes back, apart from the ones on the [Safety](https://botghost.com/docs/server-management/auto-roles#safety) tab.
- **Roles to give back**: shows with **Only the ones below**. Leave it empty and nothing comes back except the always roles.

### Always give back

Put your mute, jail, and warning roles here. They come back every time, so leaving never clears a punishment.

- **Always give back, even after a kick or ban**: these roles come back even with **Give roles back** off.
- **After a kick or ban**: what a kicked or banned member gets when they return.
  - **Only the always roles** (to start with): a kick is a fresh start, but a mute or jail role still comes back.
  - **Everything**: everything they had comes back, as if they had left.
  - **Nothing**: nothing comes back, including the always roles. The log says why.

The bot needs **View Audit Log** to know that someone was kicked or banned.

### How long roles are kept

**Remember for** sets how many days the bot keeps a member's roles after they leave, from 1 to 365. It starts at 30. After that the bot forgets them for good, and someone who comes back is treated as new.

Staff can see what's kept with `/roles saved` and remove it with `/roles forget`.

### What returning members get

![The What returning members get card with Their old roles picked, Nicknames come back and Tell them in a DM, above the Keep a copy of everyone's roles card with Remember now](https://botghost.com/docs/content/assets/workspace/auto-roles-returning-get.png)

*What returning members get, and the role copy*

- **A** **Returning members get**: their old roles, the join roles, or both.
- **B** **Nicknames come back** and **Tell them in a DM**.
- **C** **Update the copy when roles change**.
- **D** **Remember now**, with the date it last ran.
- **Returning members get**:
  - **Their old roles** (to start with): their old roles come back, and the join roles are skipped.
  - **The join roles**: they get the join roles like anyone new. Only the always roles come back.
  - **Both**: their old roles come back and they get the join roles too.
- **Nicknames come back**: off to start with. The member gets the nickname they had in this server. The bot needs **Manage Nicknames**.
- **Tell them in a DM**: off to start with. The bot sends the member a private message when their roles come back. Edit it on the **Log** tab. If their DMs are closed, they still get their roles.

The always roles come back whichever choice you pick. Bots never get kept roles back.

### Keep a copy of everyone's roles

Discord doesn't tell a bot which roles someone had when they leave. The bot keeps a copy of each member's roles, so quiet members get theirs back too.

- **Update the copy when roles change**: on to start with. The bot saves a member's roles each time they change. You can turn it off on a very large server if you never need it.
- **Remember everyone's roles now**: press **Remember now**, then press it again to start. The bot goes through every member of the picked server, up to 100,000, and copies their roles. It can take a few minutes in a big server.

Run **Remember now** once after you turn Auto Roles on. It can run once a day in each server. The button needs Auto Roles on, a server picked, and your bot saved. If it's greyed out, the line beside it says why.

## Timed roles

A timed role comes or goes after a member has been in the server for a while. For example, take **New account** away after 3 days, or give **Regular** after 30 days. A server can have up to 10.

![The Timed roles tab with two timed roles: take New account away after 3 days, and give Regular after 30 days](https://botghost.com/docs/content/assets/workspace/auto-roles-timed.png)

*The Timed roles tab*

- **A** **Add a timed role**, with how many of the 10 are used.
- **B** The **Role**.
- **C** **Do**: **Give it** or **Take it away**.
- **D** **After**: how long the member has to be in the server.
- **E** **Remove** takes two presses.

Press **Add a timed role**, then set:

- **Role**: the role to give or take away.
- **Do**: **Give it** or **Take it away**. A new one starts on **Take it away**.
- **After**: up to 90 days, counted from when they joined this time. A new one starts at 3 days. The wait is kept in whole hours.

The wait starts when a member joins and stops if they leave. Members already in the server when you add a timed role aren't counted.

## Safety

The **Safety** tab shows which roles the bot never gives by itself, and checks the roles you picked against the server's role order.

![The Safety tab with the Never given back by itself list, the Staff roles card, and Roles the bot can't reach showing one role above the bot](https://botghost.com/docs/content/assets/workspace/auto-roles-safety.png)

*The Safety tab*

- **A** The roles the bot never gives back by itself.
- **B** **Give staff roles back automatically**.
- **C** A role the bot can't give, where you picked it, and why.
- **D** **Check again**.

### Never given back by itself

Whatever your lists say, the bot skips these roles and names them in the log:

- `@everyone`.
- Roles an app or Discord manages: bot roles, the server booster role, and linked roles.
- Roles at or above the bot's highest role, and deleted roles.
- Staff roles. A staff role is any role with one of these permissions: Administrator, Manage Server, Manage Roles, Manage Channels, Manage Webhooks, Ban Members, Kick Members, Timeout Members, Mention Everyone, Manage Messages, Manage Threads, Manage Nicknames, Manage Expressions, Manage Events, View Audit Log, Mute Members, Deafen Members, or Move Members.

A skipped staff role comes back when a staff member presses **Give back the rest** on the log message, or runs `/roles giveback`.

### Give staff roles back automatically

This switch is on the **Staff roles** card, and it's off to start with. While it's off, a person always decides whether someone gets a staff role back.

When it's on, anyone who had a staff role gets it back the moment they rejoin, with nobody checking. Only turn it on if you trust everyone who has ever had a staff role in your server. Roles above the bot and managed roles are still skipped.

### Roles the bot can't reach

This card checks every role your settings would give against the picked server's role order. For each role it can't give, it shows the role's name, where you picked it, and the reason:

- The role was deleted. Take it out.
- Everyone has the role already (`@everyone`).
- An app or Discord manages the role, so no bot can give it.
- The role sits at or above the bot's highest role. Move the bot's role above it in **Server Settings**, **Roles**.
- It's a staff role, so the bot never gives it by itself.

The card also says when the bot is missing **Manage Roles**, **Manage Nicknames**, or **View Audit Log**. When everything is fine it says the bot can give every role picked here.

Press **Check again** after you change the role order in Discord. While a role can't be given for a reason other than being a staff role, or the bot is missing **Manage Roles**, the **Safety** tab shows **Check roles**.

A timed role that takes a role away still needs that role below the bot's role. Taking a staff role away is allowed.

### What Discord keeps by itself

You don't need to set up anything for these:

- A timeout stays on someone who leaves and rejoins, until it runs out.
- Server mute and server deafen in voice stay too.
- **Wait until they pass the rules screening** uses Discord's own screening and Onboarding. The [Verification](https://botghost.com/docs/server-management/verification) module gives its verified role by itself.

## Log

The **Log** tab has the log channel, the log's messages, and the replies to the `/roles` commands.

![The Log tab with the Log channel card set to #role-log and its three switches, above the When roles come back message card with Edit message and its variables](https://botghost.com/docs/content/assets/workspace/auto-roles-log.png)

*The Log tab*

- **A** The **Log channel**.
- **B** A switch for each kind of log message.
- **C** A message card. **Edit message** opens the message builder.
- **D** **Fills in** lists the variables the message can use. Click one to copy it.
- **E** The words on the message's button.

### Log channel

- **Log channel**: use a channel only staff can see. Leave it empty and nothing is logged.
- **When roles come back**: on to start with. The message has a **Give back the rest** button when a staff role was held back.
- **When someone joins**: off to start with. It posts for every join, so busy servers usually leave it off.
- **When roles couldn't be given**: on to start with. It says which roles and why, so you can fix the role order.

### Log messages

Each message has its own card with **Edit message**, so you can change all of it in the message builder.

| Message | When it's sent |
| --- | --- |
| **When roles come back** | To the log channel, when a returning member gets their roles back. |
| **When someone joins** | To the log channel, when someone gets their join roles. |
| **When roles couldn't be given** | To the log channel, when Discord refused the roles. |
| **When their roles come back, to them** | A private message to the member. It needs **Tell them in a DM** on. |

A log message is only sent once a log channel is picked and its switch is on. The card says so when it isn't.

You can change the words on the **Give back the rest** button under **When roles come back**. A button label can be up to 80 characters.

These variables fill in the messages. Each card lists the ones its message can use.

| Variable | What it shows |
| --- | --- |
| `{server}` | The server's name |
| `{ar_member}` | The member, as a mention |
| `{ar_member_name}` | The member's name |
| `{ar_member_id}` | The member's ID |
| `{ar_roles}` | The roles, as mentions |
| `{ar_roles_names}` | The roles given back, as names, for a DM where mentions don't show. Up to 25 names |
| `{ar_count}` | How many roles |
| `{ar_count_text}` | How many roles, in words: 1 role, 3 roles |
| `{ar_skipped}` | Roles the bot didn't give, with the reason |
| `{ar_skipped_text}` | The same as a sentence, or that nothing was held back |
| `{ar_left_relative}` | When they left: 3 days ago |
| `{ar_kind}` | How they left: on their own, after a kick, after a ban, or in a prune |
| `{ar_new_account}` | A line saying they got the new account role, or nothing |
| `{ar_forget_relative}` | When the bot forgets their roles: in 27 days |
| `{ar_role}` | The role `/roles keep` added |
| `{ar_error}` | What went wrong, in plain words |

### Command replies

These replies go to the person who used a command or pressed a button. Only they see them.

| Message | When it's sent |
| --- | --- |
| **When someone runs /roles saved** | The roles kept for someone who left. Staff get **Give back now** and **Forget** buttons. |
| **When staff give roles back** | After `/roles giveback`, **Give back now**, or **Give back the rest**. |
| **When staff keep a role for someone** | After `/roles keep`. |
| **When staff forget someone's roles** | After `/roles forget` or the **Forget** button. |
| **When nothing is kept** | When `/roles saved`, `/roles giveback`, or `/roles forget` finds nothing kept for that member. |
| **When staff can't give roles back** | When Discord refuses the roles. |
| **When a member tries a staff action** | When someone without **Manage Roles** tries a staff command or button. |

You can change the words on the **Give back now** and **Forget** buttons under **When someone runs /roles saved**.

## Commands

Auto Roles adds one command, `/roles`, with four subcommands.

| Command | What it does | Who can use it |
| --- | --- | --- |
| `/roles saved` | Shows the roles kept for someone who left, when and how they left, and when the bot forgets them. Leave out `member` to see your own. | Anyone for their own. **Manage Roles** for someone else's. |
| `/roles giveback` | Gives a member their kept roles back now, staff roles included. | **Manage Roles** |
| `/roles keep` | Keeps a role for someone, so they get it when they join. It works for someone who isn't in the server yet. The bot forgets it after **Remember for**. | **Manage Roles** |
| `/roles forget` | Forgets everything kept for a member. | **Manage Roles** |

Every reply is private to the person who ran the command.

![The roles commands card with /roles opened to saved, giveback, keep and forget, above The Auto Roles events card](https://botghost.com/docs/content/assets/workspace/auto-roles-commands-events.png)

- **A** `/roles`. Click it to see its subcommands.
- **B** The four subcommands, each with **Edit** and a switch.
- **C** The Auto Roles events.

Under **The roles commands**, press **Edit** on a subcommand to open it in the builder, or use its switch to turn it off.

If your bot already has a command called `/roles`, the page tells you. Discord can't have two commands with the same name, so rename or switch off yours in **Custom Commands**, or switch off this one.

## Events

Auto Roles is made of ordinary builder blocks. Under **The Auto Roles events**, open an event to see how it works or add your own blocks. The settings on the page are read by those blocks, so changing a setting never changes an event.

| Event | What it does |
| --- | --- |
| **Member Joined** | Waits for the rules screening when it should. Otherwise it runs **Arrived**. |
| **Passed Screening** | Runs **Arrived** when someone passes the rules screening. |
| **Arrived** | Gives kept roles back, then the join roles, the timed roles, and the join log. |
| **Give Back** | Works out which kept roles come back and gives them, then sends the DM and the log. |
| **Member Left** | Keeps the roles someone had, their nickname, and when and how they left. |
| **Role Added** and **Role Removed** | Keep the copy of a member's roles up to date. |
| **Log Buttons** | What **Give back the rest** and **Forget** do. |
| **Remember Everyone** | Copies every member's roles, at most once a day in each server. |
| **Website Action** | Runs **Remember Everyone** when **Remember now** is pressed. |
| **Bot Left** | Deletes every member's kept roles in a server the bot leaves. That server's settings are kept. |

### Updating Auto Roles

When a newer version is out, an **Update** button shows at the top of the page. Updating keeps your settings and messages.

## BotPanel

If your bot has a [BotPanel](https://botghost.com/docs/botpanel) website, server admins can change their own server's Auto Roles settings there and press **Remember now**. **Give staff roles back automatically** isn't on the website. You set it on your dashboard. Members' kept roles are never shown on the website.

## Moving from Sticky Roles

While Sticky Roles (old) is on, the Auto Roles page shows a strip that says **Sticky Roles (old) is on**. Its button opens the **Move my Sticky Roles** window. The window first shows everything that moves and anything that can't. Nothing changes until you press **Move my Sticky Roles**.

![The Move my Sticky Roles window listing each old setting beside what it becomes in Auto Roles, with Cancel and Move my Sticky Roles](https://botghost.com/docs/content/assets/workspace/auto-roles-move.png)

*The move window*

- **A** How many settings and kept role lists move.
- **B** Each old setting and what it becomes.
- **C** **Move my Sticky Roles**.

What moves:

| Sticky Roles (old) | Auto Roles |
| --- | --- |
| **Role Filtering Type** | **Which roles** |
| **Ignored Roles** | **Roles to leave out**, in the server each role belongs to |
| **Allowed Roles** | **Roles to give back**, in the server each role belongs to |
| **Ignore Moderation Actions** | **After a kick or ban**. On becomes **Only the always roles**, and off becomes **Everything** |
| **Send Direct Message** | **Tell them in a DM** |
| **Direct Message Setup** | Your message, as a card you can edit on the **Log** tab |
| The roles saved for members who left | Copied across and kept for **Remember for** days from the move |

Good to know about the move:

- The old module gave back every role it had saved. Auto Roles never gives back staff roles, managed roles, or roles above the bot by itself.
- A role that isn't in any server your bot is in stays behind. The window checks your bot's first 100 servers.
- A picture in your old DM doesn't move. Add it again with **Edit message**.
- If your old DM was still the default, Auto Roles uses its own welcome back message.
- **Give roles when someone joins** starts off after a move, because Sticky Roles gave no join roles. Turn it on from the **Join roles** tab when you want them.
- Keep the window open while it moves. When it's done, press **Save Changes** to switch over.

The old module is switched off and keeps its settings and saved roles. For 30 days, the strip offers **Undo the move**, which turns Sticky Roles (old) back on as it was and Auto Roles off. Save your bot to switch back.

### The Welcomer and Auto Role on Join

The move doesn't change these two. The window tells you when your bot has them.

- **The Welcomer's Give their old roles back**: both can stay on, and a role is never given twice. To let Auto Roles do it alone, switch off **Give their old roles back** on the [Welcomer](https://botghost.com/docs/server-management/welcomer) page after the move. The window also offers to keep roles for 180 days, as the Welcomer does. The roles the Welcomer already remembers stay with the Welcomer.
- **Auto Role on Join events**: they keep working beside Auto Roles. To move one, pick the same roles on the **Join roles** tab, then switch that event off in **Custom Events**.

## Every limit

| What | Limit |
| --- | --- |
| **Wait first** | Up to 7 days |
| **Younger than** (new accounts) | 1 to 365 days |
| **Remember for** | 1 to 365 days |
| Timed roles in a server | 10 |
| A timed role's **After** | Up to 90 days |
| **Remember now** | Once a day in each server, up to 100,000 members |
| Role names in `{ar_roles_names}` | 25 |
| A button label | 80 characters |
| **Undo the move** | 30 days |
