Skip to content

SGTinkers/msocietybot

Repository files navigation

MSOCIETY Bot

CI Dependencies codecov Known Vulnerabilities

A unified platform to manage MSOCIETY community.

This project is rewritten to Typescript from Go: https://gitlab.com/msociety/msocietybot

Prerequisites

Node.js 14. Install nvm (https://github.com/nvm-sh/nvm) then run nvm install.

Running

  1. Run npm i command
  2. Copy env.sample to .env
  3. Setup database settings inside .env file
  4. Create new bot and add token to .env file
  5. Run npm start command

Output verbose logging

You can turn on debug (verbose) logging via supplying the env DEBUG:

$ DEBUG=telegraf:client,msocietybot npm run start

Running (with Docker)

$ docker-compose up

Contributing

Running tests

$ npm run test

With automatic docker container setup/teardown

Make sure you have docker installed and started. Then run test with:

$ TEST_USE_DOCKER=true npm run test

With manual docker container

# start postgres in docker container exposing port 5432
$ docker run --name msocietybot-postgres -p 5432:5432 -e POSTGRES_PASSWORD=password -d postgres
$ npm run test

Migration scripts

Migration scripts can be automatically generated by TypeORM:

$ npm run create-migration {migrationName}

It will work correctly as long as you have a db running with the latest migrations applied. TypeORM will calculate the differences using the schema to generate the new migrations.