Role Assign (English)

The Role Assign command allows a user to apply a role to multiple users. This allows an automated process to add roles to multiple users over a period of time with an approximate interval of 1 second. By default, the user must have a power of 2 (Admin) to use this command.

## Syntax

Like all commands, the Role Assign command needs to start with the server's command prefix. Then followed by the word "role assign". Then, in any order, you indicate a role with either mentioning it or putting the exact name of the role and then mentioning the specific users or using @everyone.

*A recommendation is to use a private channel whilst using this command as it will require you ping the users when using the command.*

```
!role assign @role @everyone     -> @role is applied to everyone in the server over time.

!role assign @role @user1 @user2 -> @role is applied to @user1 and @user2 over time.

!role assign Role @everyone      -> @Role is applied to everyone in the server over time.

!role assign Role @user1 @user2  -> @Role is applied to @user1 and @user2 over time.

```

## How does it work?

Once the message is received the bot will check if your server actions remaining. Based on this it will either set the delay to 1 second or 10 seconds. This is a safety procedure to prevent overloading from one server.

It will then retrieve the role either mentioned or in-text in order to apply the role later. If the role isn't found it will log it and send an error.

It will then check if the message mentions the @everyone role to see if it should get everyone in the server or specific people. It will filter the people who already have the role. If everyone has the role it will log an error also if no one was mentioned it will log an error.

Finally, it will check if you (the user who issued the command) or the bot has access to those roles, if not then it will log an error.

If any error is detected at any point the command cuts to sending the error message and halting the command.

```
1. Get role from message (If Error log)

```

```
2. Check if mentions @everyone else check for user mentions (If no mentions then error)

```

```
3. Filter for users without roles (If no users remaining log error)

```

```
4. Check if user/bot can apply role themselves (If no then log error)

```

```
5. Apply role if no errors occurred OR send error message

```

```
6. If successful with no errors send message with number of role assignments done

```

## Errors and how to deal with them...

If there is an error at any point in the command it will give you a brief description of the error which is sometimes ineffective in explaining it. Here are some common errors you will face:

* **No users found:** There were no users found when the bot scanned the message. You MUST mention users in this case.

* **All the users have the role:** All the mentioned users have the role already so the bot is unable to apply the role.

* **No role mentioned:** The bot did not find a role in the message either because it was not mentioned or because the exact name could not be found. Take note that it is case sensitive and if the role mention is @public supports and you type *public support* and not *public support**s*** the bot will give you this error.

* **The role you are assigning is greater than the bot's roles:** This error refers to the role hierarchy. The bot is unable to assign a role greater than it's own, this is a safety feature built-in Discord. To fix this simply move the bot role above the role you want to add in the role manager.

* **The role you are assigning is greater than your own roles:** This error happens when your highest role is lower than the role you are trying to assign. This is a bot feature which prevents users who might have access to the command from adding a role which is higher than their highest role. Essentially it prevents moderators from becoming admins, assuming the moderator role is lower than the admin role. What do I mean by higher and lower? Look the official page for the role hierarchy.

* **Other error:** If another error occurs then join the support Discord.