- Current version of NPM used is `v6.9.0`, but almost any version should be fine.
- In the `SpikeyBot-Discord` directory, run `npm install`.

6) Get a bot token from Discord

- A token for the bot that you are trying to run from [Discord](https://discordapp.com/developers/applications/) is required.
- DO NOT give this token to anybody. Keep it private. The token allows anyone to be your bot.

7) Configure SpikeyBot

- Create `auth.js` in the `SpikeyBot-Discord/` directory with a line that says `exports.release = 'BOT_TOKEN';`, where `BOT_TOKEN` is the bot token from Discord.
- Modify `./subModules.json` `"release"` section to have the subModules you want.
- If you wish to have access to developer commands that normally only SpikeyRobot has access to, replace the `spikeyId` in `./src/common.js` with your account ID.

8) Run SpikeyBot

- Run `node src/SpikeyBot.js` in `SpikeyBot-Discord/` (working directory must be the project root).
- Errors about `gApiCredentials.json` missing can be suppressed by removing `./tts.js` and `./chatbot.js` from `./subModules.json` since these require special authentication from Google's API. (https://console.cloud.google.com/)
- All website related subModules will not work, and related errors can be suppressed by removing all subModules that start with `./web/` from `./subModules.json`.
- If you are **not** running with `--shards` and wish to use the Hungry Games submodule, you must run node with `--experimental-worker`.

Development

Unit tests exist

Covers all current commands with text-only replies.

Tests only send a message, and check for response messages that match expected output.
1) String exact match
2) String contains match
3) String does not contain match
4) String is not an error
5) Is an embed
6) Correct number of messages

Does not check the content of embeds.

Need more thorough and flexible tests.

Linting

All commits are checked by eslint using Google defaults.

Eslint is run with pre-commit git hook.

Most code is moved into subModules for easier division and reloading.

Minimal mode only loads minimal features to allow for multiple bots to run without overlap.

Music subModule downloads audio in a separate thread but is still managed by the main event loop.

SubModules are stored in ./subModules.json.

Path relative to module should be given (Usually relative to ./src/).

Must be valid for directly being passed into require().

MainModules are loaded automatically by ./src/SpikeyBot.js and are required.

SubModules are loaded by ./src/smLoader.js.

Commands are all managed by ./src/commands.js.

Additional MainModules can be loaded by placing them in ./mainModules.json

Files

Most persistent data is saved to disk when bot shuts down.

Hungry Games current state is saved and loaded.

Events and most messages are also read from file.

Timers settings are saved.

Music queues are not saved, but may continue playing after unloading submodule.