# $takeRoles

The `$takeRoles` function **removes multiple roles at once** from a user on the Discord server. The bot must have the `ManageRoles` permission.

## Syntax

```
$takeRoles[userID;role1;role2;...]
```

## Parameters

| Parameter | Description |
|---|---|
| `userID` | The ID of the target user. Required. |
| `role1;role2;...` | The IDs of the roles to remove (positive numbers), separated by `;`. At least one is required. |

## Return Value

None (empty string). An error is raised if an ID is invalid.

## Examples

### Simple Multiple Removal

```bdfd
$takeRoles[$mentioned[1];$roleID[Muted];$roleID[Warned];$roleID[Monitored]]
$sendMessage[All sanctions for <@$mentioned[1]> have been lifted.]
```

### Role Cleanup

```bdfd
$if[$isAdmin[$authorID]==true]
  $takeRoles[$mentioned[1];$roleID[VIP];$roleID[Staff];$roleID[Mod]]
  $sendMessage[All special roles removed from <@$mentioned[1]>.]
$endif
```

### Conditional Removal

```bdfd
$takeRoles[$authorID;$roleID[Old];$roleID[Inactive]]
$giveRole[$authorID;$roleID[Active]]
$sendMessage[Roles updated!]
```

## Notes

- The bot must have the `ManageRoles` permission; each role must be below the bot's highest role, and `@everyone` and managed roles cannot be removed.
- The roles are removed one after the other, so an invalid role ID stops the call after the previous roles were removed.
- The role IDs are separated by `;`.
- To remove a single role, `$takeRole` is simpler.
- To completely redefine a user's roles, use `$setUserRoles`.

## Audit log reason

This function takes any number of trailing arguments, so it has no `reason` argument of its own. Set the reason shown in the server's audit log (Discord's `X-Audit-Log-Reason`) with `$auditLogReason[text]` earlier in the script.
