The official bot for the Gurkult — an open source community with the aim of bringing people together.
If you want to contribute, report a problem, add or suggest a new fix or feature, you can open a new issue. The issue should be accepted and discussed before starting to work on the feature. See Dev Installation to know how to start working on said feature.
To get a token, go to Discord Developer Portal. Create an application and add a bot.
- Clone the repository:
-
Traditional way:
git clone https://github.com/gurkult/gurkbot.git
orgit clone git@github.com:gurkult/gurkbot.git
. -
Using Github CLI:
gh repo clone gurkult/gurkbot
.
Then navigate to the directory cd gurkbot/
- Create a new branch by
git checkout -b <name of new local branch> main
orgit switch -c <name of new local branch> main
. Make sure the new branch name is related to the feature or the fix you have in mind.
Create a .env
file in the project root folder.
Copy the contents from .env-example
file into your .env
file and fill up the fields with your bot token and server details.
-
Pre-requisites
-
Running and stopping the project
# Build image and start project # This will start both the Postgres database and the bot. # Running this the first time will build the image. docker-compose up --build # Start/create the postgres database and the bot containers. docker-compose up # Use -d flag for detached mode # This will free the terminal for other uses. docker-compose up -d # Stop project # Use ctrl+C if not in detached mode docker-compose stop # Stop and remove containers. docker-compose down # Use -v or --volumes flag to remove volumes docker-compose down --volumes # Alternativily, `docker-compose` can be # replaced with `docker compose` (without the hyphen).
-
Running only database with docker
docker-compose up postgres
-
Running only bot with docker
docker-compose up gurkbot --no-deps
-
Prerequisites
- Python 3.9
- Poetry
- Postgres database
-
Database setup
- Open terminal/cmd and enter psql
psql -U postgres -d postgres
- Create user and database
CREATE USER gurkbotdb WITH SUPERUSER PASSWORD 'gurkbotdb'; CREATE DATABASE gurkbot WITH OWNER gurkbotdb;
-
Add
DATABASE_URL
variable to.env
file.DATABASE_URL = postgres://gurkbotdb:gurkbotdb@localhost:5432/gurkbot
- format:
postgres://<username>:<password>@<host>:<port>/<database>
- If you have changed any of the parameters such has
port
,username
,password
ordatabase
during installation or in psql, reflect those changes in theDATABASE_URL
. - The host will be
localhost
unless you want to connect to a database which is not hosted on your machine.
- format:
-
Command to run the bot:
poetry run task bot
-
Commands to remember:
# Installs the pre-commit git hook. poetry run task precommit # Formats the project with black. poetry run task format # Runs pre-commit across the project, formatting and linting files. poetry run task lint # Runs the discord bot. poetry run task bot