Files
ButlerBot/README.md
2024-09-12 14:37:08 +00:00

77 lines
3.0 KiB
Markdown

# ButlerBot
## Requirements
ButlerBot is deployed using Docker. To run ButlerBot, you will need to have Docker installed on your machine. You can download Docker [here](https://www.docker.com/products/docker-desktop), or by using the following convenience script:
```bash
curl -fsSL https://get.docker.com | sh
```
## Usage
### Pre-built Docker Image
The easiest way to install ButlerBot is to use the provided Docker image with the supplied `docker-compose.yml` file, found in the project directory.
Edit the values in the `.env` file to match your environment. An example `.env` file is provided in the project directory as `.env.example`.
Before ButlerBot can be used, you will need to register any new commands with the bot. To do this, run the following command:
```bash
./scripts/register-slash-commands.sh
```
To run ButlerBot using the latest release version, use the following command:
```bash
./scripts/start.sh
```
To run ButlerBot using another version, first update the `docker-compose.yml` file to use the appropriate image. Release and development versions of ButlerBot are available on 3t.network's package repository.
| Version | Image |
| ----------- | -------------------------------------------- |
| Latest | `git.3t.network/3t.network/butlerbot:latest` |
| Development | `git.3t.network/3t.network/butlerbot:dev` |
### Building the Docker Image
Alternatively, you can build the Docker image from source. To install ButlerBot, clone the repository and navigate to the project directory. Then, build the Docker image:
```bash
./scripts/build.sh
```
This will create a Docker image called `butlerbot`, tagged with the version number found in package.json. A `docker-compose.override.yml` file is created, which automatically overrides the project's `docker-compose.yml` file to use the newly built image.
## Development
To run ButlerBot in development mode, you will need to have Node.js installed on your machine. You can download Node.js [here](https://nodejs.org/en/). ButlerBot is built using the latest Node.js LTS version.
To install the project dependencies, run:
```bash
npm install
```
To update the bot's commands, run:
```bash
npm run register-slash-commands
```
To start ButlerBot, run:
```bash
npm run start
```
N.B. ButlerBot requires several environment variables to run. These are stored in a `.env` file in the project directory. An example `.env` file is provided in the project directory as `.env.example`.
## DevOps
ButlerBot is deployed using Docker. The project includes a `Dockerfile` and `docker-compose.yml` file for building and running the bot. The `docker-compose.yml` file includes a `butlerbot` service, which runs the bot using the latest release version.
When a new release is ready, the version number in the `package.json` file should be updated using `npm version patch`, and merged into the `main` branch. This will trigger a new release on 3t.network's package repository, which can be used to update the bot's Docker image via Watchtower.