dcbot
A minimalist Discord bot that sends notifications of gained/lost villages.
Getting started
Development
Setting up the environment
Prerequisites:
- Go (>= 1.19)
- Node.js (LTS, needed for commitlint)
- Kubernetes (>= 1.25.0)
- minikube
- Docker Desktop
- Docker CLI
- Skaffold
- pre-commit
- IDE/Code editor (e.g. Goland, VSCode, vim, neovim)
- API from core
- Bot token
- direnv (optional, but recommended)
# if you have direnv installed
direnv allow
# install git hooks and required tools
make install
# copy secret.example.yml
cp ./k8s/overlays/dev/secret.example.yml ./k8s/overlays/dev/secret.yml
# encode a bot token
echo -n 'token' | base64
# add the encoded token to secret.yml
vim ./k8s/overlays/dev/secret.yml
# run all required services
skaffold run --port-forward=true --tail=true
# stop all of them
skaffold delete
Running unit tests
At least one of the following is required to run unit tests:
- Docker (dockertest will spin up a database)
- Postgres database
# Docker
go test -v ./...
# Postgres database
TESTS_DB_DSN=postgres://dcbot:dcbot_pass@127.0.0.1/dcbot go test -v ./...
Creating a new database migration
# create a migration
go run ./cmd/dcbot/main.go db create go migration 1
Configuration options
Configuration options can be specified via environment variables.
License
Distributed under the MIT License. See LICENSE
for more information.
Dawid Wysokiński - contact@dwysokinski.me