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.jsontodatabase.json - Copy
postgres.example.jsontopostgres.json - Copy
config.example.jsontoconfig.json - Put your own key into the
config.jsonfile (You can get a key for your bot at https://discord.com/developers/applications ) - Run
docker-compose upand watch the magic happen asdocker-composepulls 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.jsontodatabase.json - Fill in the details to connect to your locally running database
- Copy
postgres.example.jsontopostgres.json - Fill here the database connection in again (I know, feels redundant)
- Copy
config.example.jsontoconfig.json - Put your own key into the
config.jsonfile (You can get a key for your bot at https://discord.com/developers/applications ) - Run
yarn install - Run
yarn migrate upto run the migrations - Run
yarn startto start the bot. Or useyarn start:devto also have it automatically restart when it detects changes.
lintFixuses eslint to fix most lint errors (PR's with lint errors won't get merged)unitTestruns the unit testsprepareSqlreads the sql files and updates the generated types (use -w to run in watch mode)start:devautomatically compiles and restarts on changesbuilddoes a clean buildstartdoes a clean build, then starts the botmigrateto run db-migratelintruns eslint and tells you what the problems are.testruns 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.