2019-07-21 14:40:10 +03:00
|
|
|
# Development
|
|
|
|
These instructions are intended for bot development only.
|
2018-07-01 03:35:51 +03:00
|
|
|
|
2019-07-21 14:40:10 +03:00
|
|
|
👉 **No support is offered for self-hosting the bot!** 👈
|
|
|
|
|
|
|
|
## Running the bot
|
2019-11-08 00:20:24 +02:00
|
|
|
1. `cd backend`
|
|
|
|
2. `npm ci`
|
|
|
|
3. Make a copy of `bot.env.example` called `bot.env`, fill in the values
|
|
|
|
4. Run the desired start script:
|
|
|
|
* `npm run start-bot-dev` to run the bot with `ts-node`
|
|
|
|
* `npm run build` followed by `npm run start-bot-prod` to run the bot compiled
|
|
|
|
* `npm run watch-bot` to run the bot with `ts-node` and restart on changes
|
|
|
|
5. When testing, make sure you have your test server in the `allowed_guilds` table or the guild's config won't be loaded at all
|
2019-07-21 14:40:10 +03:00
|
|
|
|
|
|
|
## Running the API server
|
2019-11-08 00:20:24 +02:00
|
|
|
1. `cd backend`
|
|
|
|
2. `npm ci`
|
|
|
|
3. Make a copy of `api.env.example` called `api.env`, fill in the values
|
|
|
|
4. Run the desired start script:
|
|
|
|
* `npm run start-api-dev` to run the API server with `ts-node`
|
|
|
|
* `npm run build` followed by `npm run start-api-prod` to run the API server compiled
|
|
|
|
* `npm run watch-api` to run the API server with `ts-node` and restart on changes
|
2019-07-21 14:40:10 +03:00
|
|
|
|
|
|
|
## Running the dashboard
|
2019-11-08 00:20:24 +02:00
|
|
|
1. `cd dashboard`
|
2019-07-21 14:40:10 +03:00
|
|
|
2. `npm ci`
|
|
|
|
3. Make a copy of `.env.example` called `.env`, fill in the values
|
2019-11-08 00:20:24 +02:00
|
|
|
4. Run the desired start script:
|
|
|
|
* `npm run build` compiled the dashboard's static files in `dist/` which can then be served with any web server
|
|
|
|
* `npm run watch` runs Parcel.js's dev server that automatically reloads on changes
|
|
|
|
|
|
|
|
## Notes
|
|
|
|
* Since we now use shared paths in `tsconfig.json`, the compiled files in `backend/dist/` have longer paths, e.g.
|
|
|
|
`backend/dist/backend/src/index.js` instead of `backend/dist/index.js`. This is because the compiled shared files
|
|
|
|
are placed in `backend/dist/shared`.
|
|
|
|
* The `backend/register-tsconfig-prod-paths.js` module takes care of registering shared paths from `tsconfig.json` for
|
|
|
|
`ts-node`, `ava`, and compiled `.js` files
|
|
|
|
* To run the tests for the files in the `shared/` directory, you also need to run `npm ci` there
|
2019-07-21 14:40:10 +03:00
|
|
|
|
|
|
|
## Config format example
|
|
|
|
Configuration is stored in the database in the `configs` table
|
2018-07-01 03:35:51 +03:00
|
|
|
|
|
|
|
```yml
|
2019-07-21 14:40:10 +03:00
|
|
|
# role id: level
|
2018-07-01 03:35:51 +03:00
|
|
|
levels:
|
2019-07-21 14:40:10 +03:00
|
|
|
"12345678": 100 # Example admin
|
|
|
|
"98765432": 50 # Example mod
|
2018-07-01 03:35:51 +03:00
|
|
|
|
|
|
|
plugins:
|
|
|
|
mod_plugin:
|
|
|
|
config:
|
|
|
|
kick_message: 'You have been kicked'
|
2019-07-21 14:40:10 +03:00
|
|
|
can_kick: false
|
2018-07-01 03:35:51 +03:00
|
|
|
overrides:
|
|
|
|
- level: '>=50'
|
2019-07-21 14:40:10 +03:00
|
|
|
config:
|
|
|
|
can_kick: true
|
2018-07-01 03:35:51 +03:00
|
|
|
- level: '>=100'
|
|
|
|
config:
|
|
|
|
kick_message: 'You have been kicked by an admin'
|
2019-11-08 00:20:24 +02:00
|
|
|
|
|
|
|
other_plugin:
|
2018-07-01 03:35:51 +03:00
|
|
|
config:
|
2019-11-08 00:20:24 +02:00
|
|
|
categories:
|
|
|
|
mycategory:
|
|
|
|
opt: "something"
|
|
|
|
othercategory:
|
|
|
|
enabled: false
|
|
|
|
opt: "hello"
|
2018-07-01 03:35:51 +03:00
|
|
|
overrides:
|
|
|
|
- level: '>=50'
|
|
|
|
config:
|
2019-11-08 00:20:24 +02:00
|
|
|
categories:
|
|
|
|
mycategory:
|
|
|
|
enabled: false
|
|
|
|
- channel: '1234'
|
|
|
|
config:
|
|
|
|
categories:
|
|
|
|
othercategory:
|
|
|
|
enabled: true
|
2018-07-01 03:35:51 +03:00
|
|
|
```
|