Add features
This commit is contained in:
70
README.md
70
README.md
@@ -1,28 +1,76 @@
|
||||
# ButlerBotNG
|
||||
# ButlerBot
|
||||
|
||||
## Installation
|
||||
## 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
|
||||
$ npm install
|
||||
curl -fsSL https://get.docker.com | sh
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
1. Create `.env` (see `example.env`) and populate with all necessary details.
|
||||
2. Register slash commands.
|
||||
### 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
|
||||
$ npm run register-slash-commands
|
||||
./scripts/register-slash-commands.sh
|
||||
```
|
||||
|
||||
3. Run ButlerBot.
|
||||
To run ButlerBot using the latest release version, use the following command:
|
||||
|
||||
```bash
|
||||
$ npm run start
|
||||
./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
|
||||
|
||||
All commands are dynamically loaded at runtime, and are stored in `src/commands/[CATEGORY]/[NAME].js`.
|
||||
To add a new command, just create a new .js file. It must export a `data` object and `execute` promise. See existing commands for an example.
|
||||
Remember to re-register slash commands using `npm run register-slash-commands` if adding a new command, or modifying an existing command's parameters.
|
||||
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.
|
||||
|
||||
Reference in New Issue
Block a user