This is a simple discord bot to keep track of helpful people so mods can reward them. It also has a few moderator commands, basic scam protection and various other commands so that the members of the discord server can better help each other.
- Node (v14.10.0)
- Yarn (npm install yarn -g)
- Postgresql
- Install docker and docker compose
- Copy
database.example.json
todatabase.json
- Copy
postgres.example.json
topostgres.json
- Copy
config.example.json
toconfig.json
- Put your own key into the
config.json
file (You can get a key for your bot at https://discord.com/developers/applications ) - Run
docker-compose up
and watch the magic happen asdocker-compose
pulls in everything needed and starts the bot.
To access the DB from the host and run yarn prepareSql
, read How to access the DB from the host while using Docker
- Copy
database.example.json
todatabase.json
- Fill in the details to connect to your locally running database
- Copy
postgres.example.json
topostgres.json
- Fill here the database connection in again (I know, feels redundant)
- Copy
config.example.json
toconfig.json
- Put your own key into the
config.json
file (You can get a key for your bot at https://discord.com/developers/applications ) - Run
yarn install
- Run
yarn migrate up
to run the migrations - Run
yarn start
to start the bot. Or useyarn start:dev
to also have it automatically restart when it detects changes.
lintFix
uses eslint to fix most lint errors (PR's with lint errors won't get merged)unitTest
runs the unit testsprepareSql
reads the sql files and updates the generated types (use -w to run in watch mode)start:dev
automatically compiles and restarts on changesbuild
does a clean buildstart
does a clean build, then starts the botmigrate
to run db-migratelint
runs eslint and tells you what the problems are.test
runs the linter and the unit tests
By default, the postgresql container has a port opened at 5433
.
The default username is thanks_bot_2
, so is the database name and password.
The example configuration file postgres.example.json
is setup to connect to the postgresql container from the host. This way, yarn prepareSql
works out of the box with docker, provided the container is running. There is NO need to run this command from withing the container. ONLY run it from the host!
If you want to connect to the Database with dbeaver from the host then simply configure a new connection, select the postgresql
driver and fill the details in as followed:
Host
: localhost
Port
: 5433
Database
: thanks_bot_2
Authentication
: Database Native
Username
: thanks_bot_2
Password
: thanks_bot_2
Session role
and Local client
can remain empty.