-
Notifications
You must be signed in to change notification settings - Fork 18
2. Getting involved with Development
While you do not need to be a member of Practical Python, or our GitHub Org in order to contribute to Zorak. Joining the organization is certainly the recommended way of doing things. It's free, there is no commitment, and you get the perks of a shiny badge on your profile, so why not?
To clone Zorak onto your local machine, use the command:
git clone https://github.com/practical-python-org/ZorakBot.git
A folder called ZorakBot will be added to the directory you are currently in, and all the project files will be added in it.
So, there are two ways to run Zorak. The first, and preferred way is using Docker. This method uses the full Database support for Zorak with an .env file.
- Jump to: Running Zorak using Docker
The second method does not use a .env file, and instead uses command line args. This method also does not use the database, so DB features will not be available!
- Jump to: Running Zorak without the Database
You might want to run Zorak without using the database, if your feature does not require it. To do so simply use pip:
pip install .
Then you can run Zorak using:
zorak -dt <DISCORD_TOKEN_HERE> -ssp Resources/ServerConfig/Zorak-Dev -dd True -cl True --upgrade --no-deps --force-reinstall
The arguments are explained as follows: -ssp: Variable that sets the location to the server settings to use. -dd: Flag that allows you to drop the database. -cl: Flag that enables streaming logs to console.
The easiest way to get started is to run Zorak locally and in our test server (Contact a repo admin for an invite!).
After cloning the repo create an .env file from '.env.example', which is in the \ZorakBot\ folder.
DISCORD_TOKEN=xxxxx # secret token found here https://discord.com/developers/applications
SERVER_SETTINGS=Resources/ServerConfig/PracticalPython # Path to the settings file that contains all Guild info
TAG=latest
ENVIRONMENT=dev # Lets us use just the one docker-compose for both dev and prod
LOGGING_LEVEL=20
STREAM_LOGS=FALSE
Docker will use these env variables to spin up your instance of Zorak. Go ahead and run:
docker-compose up -d
Be warned, on the first run you have to download all the dependencies which can take a few minutes.
After making a change, rebuild only the Zorak container, and run the container using a token.
docker build -t zorak .
and then
docker run --env-file ./.env zorak -dd True -dt <DISCORD_TOKEN_HERE>
It's important that when you are finished using docker, you bring down all of your containers so the bot doesn't run on your machine forever. You can do that simply by using
docker-compose down
this command will stop all Zorak containers, remove them, and clean up the images.
The logging level can be set in the .env file. Below is an overview of the name / integer value of the level.
- NOTSET=0
- DEBUG=10
- INFO=20
- WARN=30
- ERROR=40
- CRITICAL=50