Typescript Discord Bot that serves the Dignity of War community.
This project is now considered stable, and is now versioned appropriately via SemVer.
- Install brew (on Mac / Linux), or your own package manager, I'm not your mum!
- Install node version manager
nvm
:brew install nvm
- Install
pnpm
:brew install pnpm
- Run
nvm install 20.15.1
which will set up your node version correctly. - Ensure you have at least
pnpm
version9.1.2
installed.
The engines are enforced via package.json
, you'll know if it's wrong as no commands will work.
pnpm install
. NOTE on WSL, see WSL compatability section.- Create a copy of
.env.example
file, name it.env
and add your bot token into it (grab it from the Discord Developers site). - Run
start.sh
. - Invite the bot to your server.
This project uses MikroORM which is a TS native ORM. We use MariaDB (the same as in the docker-compose.yaml
) both in local dev and production.
While this project is designed for a Mac ecosystem, it can be run on WSL, but you need to make the following bodges:
- Rather than running
pnpm install
, you need to runnpm install
, aspnpm
creates symlinks that winblows doesn't understand, thus your IDE will likely break. Grab a brew, it will take fecking forever to install everything with npm. - You cannot use docker's internal DNS for some reason.
DB_HOST
in your.env
needs to be127.0.0.1
. - Tests are a problem when running from within WSL. The filesystem absolutely shits the bed (it went up to 500MB/s on an SSD...). I figured this is due to the multi-concurrency, so run
pnpm test:wsl
to set maxWorkers to 4. If you're finding it's still locking up, adjust the worker count to 1/2 inpackage.json
.
Error: MikroORM config file not found in ['./src/mikro-orm.config.ts', './mikro-orm.config.ts']
This is due to ts-node not properly transpiling typescript into javascript which the package understands. To get round this, you can run pnpm build
to in effect create the files for the migration to be able to run. Don't ask me why it works, it just does.