Bot for the Discord Server of The Morpheus Tutorials
- Python >=3.9
- Pipenv
- Git
- Docker (recommended)
- docker-compose (recommended)
- PyCharm Community/Professional (recommended)
After you have cloned the repository, you should create a virtual environment and install all dependencies. For this you can use the following command:
pipenv install --dev
To set the required environment variables it is necessary to create a file named .env
in the root directory. If you need a token, generate one by following these instructions: Creating a Bot Account (Note you need to enable the options under Privileged Gateway Intents
)
TOKEN=xxx
Inside the project you can find all bot features (like the mod tools) in the cogs
directory.
The database is represented by the models, which can be found in the models
directory.
For translations we use a .yml
file which can be found in the translations
directory.
Project
│
└───morpheushelper
│ └───cogs
│ │ │ adventofcode.py
│ │ │ automod.py
│ │ ...
| |
│ └───models
│ │ allowed_invite.py
│ │ aoc_link.py
│ ...
|
└───translations
│ en.yml
...
- Open PyCharm and go to
Settings
➔Project: MorpheusHelper
➔Python Interpreter
- Open the menu
Python Interpreter
and click onShow All...
- Click on the plus symbol
- Click on
Pipenv Environment
- Select
Python 3.9
asBase interpreter
- Confirm with
OK
Finally, please remember to mark the morpheushelper
directory as Sources Root
(right click on morpheushelper
➔ Mark Directory as
➔ Sources Root
).
# clone git repository
git clone https://github.com/Defelo/MorpheusHelper
# build docker image
sudo docker build -t defelo/morpheushelper MorpheusHelper
# adjust the docker-compose.yml file (e.g. with your discord token)
vim MorpheusHelper/docker-compose.yml
# start database and bot using docker-compose
sudo docker-compose -f MorpheusHelper/docker-compose.yml up -d
# install pipenv
pip3 install pipenv
# create virtual environment and install requirements
pipenv install
# start the bot
pipenv run bot
Variable Name | Description | Default Value |
---|---|---|
TOKEN | Discord Bot Token | |
DB_HOST | Hostname of the database server | localhost |
DB_PORT | Port on which the database server is running | 3306 |
DB_DATABASE | Name of the database in which morpheushelper should store data. | test |
DB_USER | Username for the database account | test |
DB_PASSWORD | Password for the database account | test |
SENTRY_DSN | [Optional] Sentry DSN for logging | |
OWNER_ID | [Optional] Discord User ID of the person who should recieve status information. | |
DISABLED_COGS | [Optional] Cogs you'd like to disable. | |
AOC_SESSION | [Optional] Session cookie of the AOC Website |