This custom discord-python bot assigns roles to members joined at discord server. It looks and compares a list before verifying the roles. Helps to forming naming convention and simplify the registration process, deployed via heroku.
-
Clone this repo
git clone https://github.com/edwinjosegeorge/Tinky-discord-bot.git cd Tinky-discord-bot
-
Create virtual environment (optional)
python3 -m pip install --user virtualenv python3 -m venv myBotEnv source myBotEnv/bin/activate
Note: include the environment directory in .gitignore
-
Install libraries
pip install -r requirements.txt
-
Setup the config variables
i. Set up system variables (recommended) Create a file
.env
and add tokens.SERVER_ID='the id of server' SERVER_NAME='name of server' BOT_TOKEN='token of your bot' DATABASE_URL='cloud database url'
ii. Update settings.py file (not recommended) Update settings.py to the following
SERVER_ID=int('the id of server') SERVER_NAME=str('name of server') BOT_TOKEN=str('token of your bot') DATABASE_URL=str('cloud database url')
Config variables can be fetched from your deployment environment. To obtain bot config, visit Discord.py developers portal
-
Updating the code
- Update and suite the DataBase interactions at PSQL_hooks.py. Details how to interface database.
- Update and suite Bot interactions at BOT.py. Details when, where and how the bot should be triggered.
- Update and suite the registration interaction with discord member at memberProp.py.
- Update display messages at messageBox.py. Messages during registration process are save in memberProp.py.
- Update the discord-to-database interactions (the core rules) at integrations.py. Details how and what to update to meet constraints.
-
Run you bot
python3 BOT.py