Setting up reaction roles
MoonlightBot allows users to assign or remove roles from themselves by reacting to specific messages that server admins set up for. There are several customization options to supercharge your server to the top.
Before beginning, make sure of the following things:
- MoonlightBot has View Messages, Send Messages, Add Reactions and Manage Messages permissions in both the channel you're using commands in and the one you want reaction roles to be applied to
- Plan ahead what roles and emojis you want to use
A group is a collection of emoji to role pairs and settings. Groups are independent for each other. After setting the appropriate pairs, you can apply the group to messages so users can start interacting with the bot and gain roles.
To create a group, use this command:
/reaction-roles create <name>
<name>with a short, memorable name that you will remember later for every reaction roles operation.
Creation of a group named "pets"
Group names can contain only alphanumeric characters, underscores and dashes. They must be unique and no longer than 32 characters.
Now that you have a group made, you need to configure what emoji users need to react to get roles.
You do that with the
setrolescommand in this fashion:
/reaction-roles setroles <group>
<group>is the name of your group. Using this command will begin a guided process to set your roles. First, you will be asked to input a role (with a name, ID or mention), then react to the reply message to tie it to an emoji.
Step 1: the role (yellow), step 2: the reaction (green)
Add as many as you want, or stop adding roles with
You can use custom emojis as well, but they must be uploaded in the same server as you're setting it up.
There are a few things to note:
- The same role can be given by multiple different emojis in the same group
- A single emoji can be paired with only one role (later you'll see how to make an emoji give multiple roles)
- You can only add up to 20 pairs per group (Discord only allows 20 different reactions per message)
This is the last required step to do before making reaction roles operative for your users. This consists in making the bot acknowledge that reactions in that group have to assign roles.
To do this, you simply need to use the following command:
/reaction-roles apply <group> <message>
<group>is a group you created before, and
<message>is for the message the reaction roles will work on. The following are valid message identifiers:
- A simple message ID, like
663696313086509106. This only works if the message was sent in the channel you're using the command in.
- A Channel ID and a message ID, separed by a single dash, like
659297716920254465-663696313086509106. You can get this by holding the SHIFT key while copying the message ID. This works if you want to keep the reaction roles channel clean.
- (recommended) A message link, composed of Server ID/Channel ID/Message ID, like
https://discord.com/channels/359057740200673280/659297716920254465/663696313086509106. Right click (or long press) the message from mobile then click "Copy Link". You can then paste the link from your clipboard.
And voila! The bot will ask you to confirm since already existing reactions will be removed, then, all reactions from the group will be added. This operation may take about 20 seconds to complete, depending on the amount of reactions.
If you add more roles later on, you can use this command again to refresh the reactions.
You've done it! You can now pass to more advanced, optional customization.
configcommand offers a voice to edit group settings. Those are completely optional and are effective immediately, let's see some here:
/config reactionroles <group>
- JoinOnly allows users to add themselves the roles, but not remove them.
- LeaveOnly works the opposite of JoinOnly: it allows users to remove themseves the roles, but not add them.
- MaxRoles is the amount of roles of the group the user can have at the same time. Useful if you want someone to choose one role but not have the others (this is a number, so it can be any higher value!)
- Duration is how long the role lasts after being added. This makes the group work like a temprole!
/config arguments: reactionroles <group> duration <duration>to add a timer that starts when the reaction is clicked. The duration is provided in, say, the same way as you use the
Yes! However, group settings are common for each role in the group. Though you can apply multiple groups to the same message, which will allow you to:
- Make some roles temporary, and other ones permanent
- Make some roles only joinable, while removing other ones on click ... And much more, you can experiment which settings works best for you.
/config arguments:reactionroles <group> dmnotification falseto disable notifications for a group.
You can disable all reaction role notifications in every server with
/userconfig arguments: reactionrolenotifications falsefor your account. This will take precedence over server settings regardless.
You can re-enable both at any time replacing