Skip to content

Getting Started

Ian Mitchell edited this page Oct 6, 2020 · 6 revisions

Creating a Bot

You'll first need to create a bot and add the bot to a development server.

Easy Mode: GitHub Codespaces and Remote Containers

Aquarius has a devcontainer that allows GitHub Codespaces and Visual Studio Code to create a VM that comes preconfigured with everything you need to get up and running. The only thing you need to do is create a .env file and then you're done!

GitHub Codespaces will configure everything for you automatically. For VS Code, install the extension and open the cloned repository. It will ask if you want to open the folder in a container - say yes.

Environment Recommendations

I'll call out some optional recommendations here - you don't need any of this in order to develop and run Aquarius, but I promise it helps!

Visual Studio Code

Link: https://code.visualstudio.com/

The repository is setup to work well with Visual Studio Code. You can add breakpoints and run the "Launch Aquarius" task to start the bot in "Debug" mode. Many of the core APIs also have JSDoc integrations for VS Code's intellisense.

You can definitely still use your editor of choice, but if you haven't used VS Code before it's worth giving it a shot!

When you open the Aquarius codebase in VS Code the editor will prompt you to install recommneded plugins and use some recommended settings.

Volta

Link: https://volta.sh/

Volta is a useful tool to manage your node version and global packages. This isn't necessary, but it will help keep Aquarius isolated from other development projects you are working on. I'll call out how to use it in the sections below.

Node.js

Volta? volta install node@14

Install version 14 or later of Node.js.

Install Dependencies

Global Dependencies

Volta? volta install lerna

Aquarius requires Lerna in order to run - Lerna pieces together the different packages into the main application. To install run:

$ npm install --global lerna

Project Dependencies

Run the following to install all of the dependencies:

$ lerna bootstrap --hoist

If you get a node-gyp error you might need to install Python 2.7.

PostgreSQL

You'll need to install PostgreSQL on your system and get it up and running. Once it's done, add the connection string to .env under DATABASE_URL. Then tell Aquarius to setup the database with:

$ npm run db:create

Environmental Variables

Create a .env file with the following API keys:

NODE_ENV=development
GIT_HASH=development
POSTGRESQL_URL=?
SENTRY_AUTH_TOKEN=?
TOKEN=?
CLIENT_ID=?
SENTRY=?
DICTIONARY_API_KEY=?
TEST_BOT_TOKEN=?
HEARTHSTONE_KEY=?
TIMBER_KEY=?
SHOWTIMES_SERVER=?
SHOWTIMES_KEY=?
TVDB_API_KEY=?
GITHUB_API_TOKEN=?
DARK_SKY_API_KEY=?
MAPBOX_API_KEY=?
DIGITAL_OCEAN_API=?
ALPHA_VANTAGE_KEY=?
Where to get API Keys

TODO: Describe how to get each API Key

Config File

Aquarius comes with a config file that defines some default behavior. You can find it under packages/aquarius/config.yml.

You should update the owner key, remove the admins list, and modify the Guild ID and TextChannel ID under home.

Running the bot

Each time you make a change you'll need to restart the bot. You can run it with the following command:

$ npm start

The bot will take a few seconds to connect. You can test it by sending ping in a channel it can respond in (Aquarius should reply with pong).

Running the dashboard

The dashboard is a Next.js website. To run it in development, run

$ npm run dev

And visit http://localhost:3000

Running Tests

To run the Aquarius test suite use the following command

$ npm run lint && npm test