A bot for the Creation Asylum Discord

Readme

Venom Discord Bot

This is the Discord bot for Creation Asylum.

Major credits to jondeaves and gslance for most of the original infrastructure and commands. ❤️

Development

Requirements

Running

  • Run pnpm install to install dependencies
  • Copy .env.local.example to .env.local and add the missing values
  • Run pnpm dev to start in development mode

VSCode

For VSCode install the following plugins;

You wil also want to use the below configuration in .vscode/settings.json to have Prettier auto-format code for you.

{
  "eslint.packageManager": "pnpm",
  "javascript.format.enable": false,
  "editor.formatOnSave": true
}

Environment Variables

At a minimum you need to provide the DISCORD_TOKEN (which can be found on the Bot tab of a Discord application) and MONGODB_URI values. See .env.local.example for a full list with more information about each variable.

Bot commands

To add a command you can run the following script:

pnpm gen command my_command_name

Deployment

Linux

You can deploy on a Linux machine using Docker.

pnpm install-services

This will install 2 services on system.d:

  1. venom-bot.service - runs the bot
  2. venom-db.service - runs the Mongo database using Docker

They are both set to re-start on failure. You should start them by running:

pnpm db start
pnpm bot start

You can view logs using:

pnpm db logs
pnpm bot logs

Any subcommand other than logs is passed directly to system.d with the appropriate service name, so you can use things like start, stop, restart, enable, disable and so on.

To update the bot from source, simply use:

git pull
pnpm bot restart

IMPORTANT: Don’t forget to save the MegaHAL brain for the bot before restarting it by sending !chat save on any whitelisted channel the bot is on.