-
Notifications
You must be signed in to change notification settings - Fork 64
Home
Easy to use self-hosted reaction role Discord bot written in Python.
First, you need to create a bot user on Discord Developer Portal.
Once you created a bot, you will need to activate the message content intent under the bot section, as well as saving the bot token you generated for later use in this installation guide.
Before moving onto downloading and running the bot, invite the bot user you have just created to your server with the following link (ensuring to replace CLIENT_ID with the ID shown in the general information tab):
https://discord.com/oauth2/authorize?&client_id=CLIENT_ID&scope=bot%20applications.commands&permissions=2415978560
On your Discord server, go to: Server Settings > Roles and move Reaction Light in a position that is above all roles that it needs to add/remove. The bot only has permission to manage the roles below its own role.
Continue below depending on your preferred deployment method (Docker, Unraid, Git).
Create a directory to store your configuration and database files in the location you prefer:
mkdir -p reaction-light/files
mkdir reaction-light/config
cd reaction-lightReplace INSERT_YOUR_TOKEN with the token you generated beforehand. You can change the bot's name and embed's logo (not to be mistaken with the bot's avatar) by replacing the values accordingly.
You can pull the Docker image of Reaction Light from our GitHub Packages:
docker pull ghcr.io/eibex/reaction-light:latestOnce you pulled the last Docker image, you can run the container (replacing the /path/to/reaction-light strings with the location of your reaction-light directory and replacing INSERT_YOUR_TOKEN with your Discord Bot Token):
docker run -d \
--name reaction-light \
--restart always \
-v /path/to/reaction-light/files:/bot/files \
-v /path/to/reaction-light/config:/bot/config\
-e 'TOKEN'='INSERT_YOUR_TOKEN' \
ghcr.io/eibex/reaction-light:latestNow the bot should be up and running. Run rl!admin @Role to give users with that role permission to create reaction-role messages (even administrators need it). You need to be a server administrator to use this command.
Insert the Discord Bot Token you have just obtained in the Discord Bot Token field. You only need to specify this field on the bot's first run.
It is generally recommended to replace /mnt/user/appdata with /mnt/cache/appdata (or what your pool name is for appdata if it is not cache) to improve performance/reduce resource consumption (only do this if you are comfortable making these changes yourself knowing your own setup).
You can change the bot's name and embed's logo (not to be mistaken with the bot's avatar) by manually editing the values in appdata/reaction-light/config/config.ini.
Clone the repository using:
git clone https://github.com/eibex/reaction-light.gitgit comes pre-installed on most Linux-based operating systems. On Windows, if you are not familiar with git, you can use GitHub Desktop
While inside the reaction-light directory, install requirements via pip using:
python3 -m pip install -r requirements.txtRun setup.py and follow the instructions or create a config.ini file (example provided in config.ini.sample) or edit it manually.
python3 setup.pyInsert the token of your bot (found at: https://discord.com/developers/applications/). You can set most of the other values via commands later (set manually name and logo, which appear in the footer of each embed).
If you do not have or want to use tmux or screen, the bot can be run as a background task by using:
nohup python3 bot.py &Now the bot should be up and running. Run rl!admin @Role to give users with that role permission to create reaction-role messages (even administrators need it). You need to be a server administrator to use this command.
You can view new features in the changelog.
If you set a system channel in config.ini, your bot will check for new versions from this repository. If updates are available a message is sent briefly outlining the update process. This process varies depending on how you installed the bot.
Type /bot update to update the bot and restart it.
Note: If you update a docker installation with the /bot update command and you need to update a dependency (i.e. disnake, python), you will need to update the Docker container manually.
First, stop and delete the reaction-light container using:
docker stop reaction-light && docker rm reaction-lightRe-pull the Docker image using:
docker pull ghcr.io/eibex/reaction-light:latestCreate and start a new container using:
docker run -d \
--name reaction-light \
--restart always \
-v /path/to/reaction-light/files:/bot/files \
-v /path/to/reaction-light/config.ini:/bot/config.ini \
ghcr.io/eibex/reaction-light:latestOptionally, remove all orphaned images:
docker image prune -a- Navigate to the reaction-light directory
- Run
git pull origin master - Shutdown the bot by using the
/bot killcommand. You can also use/bot restarton Linux-based systems. - Start the bot again