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, but recommended)
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) Add the following to your shell/bash
SERVER_ID='the id of server' SERVER_NAME='name of server' BOT_TOKEN='token of your bot' DATABASE_URL='cloud database url' SOCIAL_POST_CHANNEL='id of channel'
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') SOCIAL_POST_CHANNEL=str("id of channel")
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 database. 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 member.
- Update display messages at messageBox.py. Messages during registration process are save in member.messageBox..
-
Run you bot
python3 BOT.py