Skip to content

Nuclear-Engineering-Co/NECos

Repository files navigation

NECos


NECos is a Discord bot & REST API developed for the Nuclear Engineering Co. (See links below).

Links

NECos Releases
Nuclear Engineering Co.
NECo Discord

Information

NECos has a built-in CLI utility, via the necos script in the root project directory. Run ./necos usage to get a list of commands.
You can also run the application manually by requiring the NECos.ts file.

NECos is written in TypeScript, but it also ships with ts-node as a dependency so you're good there.
However, NECos requires npx, if starting the bot via CLI.

Installation

  1. Clone the NECos repository to whatever directory you'd like.
  2. Run npm install, or yarn install. PNPM has NOT been tested.
  3. Copy the config.example directory to config. The application will NOT start without valid configuration. See configuration below.
  4. Initialize the database by running NODE_OPTIONS="--loader ts-node/esm" knex migrate:latest --knexfile config/dbconfig.ts
  5. You're done!

Configuration

NECos requires a working database backend. The application uses Knex as a database backend. The database can be configured in config/dbconfig.js. By default you have two "environments", development and production. The environment used is dependent on the NODE_ENV environment variable. This is to ensure testing and production data are separate, as not to accidentally corrupt anything from update to update.

App

In config/application.toml, you have three different configuration sections, app, bot, and api.
App configuration is global configuration values that are used throughout the framework.

Bot

Bot configuration contains discord-specific values for the bot to use. Values such as token must be set for the discord application to run. It can be disabled via changing enabled = false in the bot section.

API

API configuration is for the REST API for external data access. This feature is coming soon.

Running the application

To run NECos, it's as simple as running ./necos start, and optionally adding the --debug flag for extra output messages. (For all flags, see ./necos usage')

NOTE TO SELF: USE NODE_ENV=production NODE_OPTIONS="--loader ts-node/esm" knex migrate:make --knexfile config/dbconfig.ts create_guilds_table TO MAKE THINGS -sky