docs: update deployment instructions with all three methods (.env file, docker run env vars, docker-compose)
This commit is contained in:
@@ -1,5 +1,9 @@
|
|||||||
# Matrix Ancestor Quote Bot Configuration
|
# Matrix Ancestor Quote Bot Configuration
|
||||||
|
|
||||||
MATRIX_HOME_SERVER=https://your.matrix.server.com:443
|
# Replace these values with your own:
|
||||||
|
MATRIX_HOME_SERVER=https://matrix.org
|
||||||
MATRIX_ACCESS_TOKEN=your_access_token_here
|
MATRIX_ACCESS_TOKEN=your_access_token_here
|
||||||
BOT_COMMAND=!quote
|
BOT_COMMAND=!quote
|
||||||
|
|
||||||
|
# Optional: Enable debug logging (set to false in production)
|
||||||
|
DEBUG=false
|
||||||
|
|||||||
13
Dockerfile
13
Dockerfile
@@ -1,7 +1,18 @@
|
|||||||
FROM node:18-alpine
|
FROM node:18-alpine
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Copy package files first for better layer caching
|
||||||
COPY package*.json ./
|
COPY package*.json ./
|
||||||
|
|
||||||
|
# Install dependencies (including dotenv)
|
||||||
RUN npm install
|
RUN npm install
|
||||||
|
|
||||||
|
# Copy application source code
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN npm prune --production
|
|
||||||
|
# Expose port if needed (optional, Matrix uses websocket)
|
||||||
|
# EXPOSE 3000
|
||||||
|
|
||||||
|
# Run the bot (dotenv will auto-load from /app/.env or environment variables)
|
||||||
CMD ["node", "index.js"]
|
CMD ["node", "index.js"]
|
||||||
87
README.md
87
README.md
@@ -1,40 +1,69 @@
|
|||||||
# Ancestor Quote Bot
|
# Ancestor Quote Bot 🎃
|
||||||
|
|
||||||
A Matrix chatbot that responds to `/quote` commands with random quotes from Darkest Dungeons' Narrator/Ancestor.
|
A Matrix chatbot that responds to `!quote` commands with random quotes from Darkest Dungeons.
|
||||||
|
|
||||||
## Setup
|
## Quick Start
|
||||||
|
|
||||||
1. Copy `.env.example` to `.env` and fill in your credentials:
|
```bash
|
||||||
```bash
|
# 1. Update .env file (create from template)
|
||||||
cp .env.example .env
|
cp .env.example .env
|
||||||
```
|
# Edit .env with your MATRIX_ACCESS_TOKEN and MATRIX_HOME_SERVER
|
||||||
|
|
||||||
2. Build the Docker image:
|
# 2. Build Docker image
|
||||||
```bash
|
docker build -t ancestor-quote-bot .
|
||||||
docker build -t ancestor-quote-bot .
|
|
||||||
```
|
|
||||||
|
|
||||||
3. Run the bot:
|
# 3. Run the bot
|
||||||
```bash
|
docker run --rm \
|
||||||
docker run --rm \
|
-e MATRIX_HOME_SERVER=https://matrix.org \
|
||||||
-e MATRIX_HOME_SERVER=https://your.matrix.server.com \
|
-e MATRIX_ACCESS_TOKEN=your_token_here \
|
||||||
-e MATRIX_ACCESS_TOKEN=your_access_token_here \
|
ancestor-quote-bot
|
||||||
ancestor-quote-bot
|
```
|
||||||
```
|
|
||||||
|
## Deployment Options
|
||||||
|
|
||||||
|
### Option 1: Pass env vars via `docker run` (Recommended for Docker)
|
||||||
|
```bash
|
||||||
|
docker run --rm \
|
||||||
|
-e MATRIX_HOME_SERVER=https://matrix.org \
|
||||||
|
-e MATRIX_ACCESS_TOKEN=your_access_token_here \
|
||||||
|
-e BOT_COMMAND=!quote \
|
||||||
|
ancestor-quote-bot
|
||||||
|
```
|
||||||
|
|
||||||
|
### Option 2: Mount .env file directly
|
||||||
|
```bash
|
||||||
|
docker run --rm \
|
||||||
|
-v $(pwd)/.env:/app/.env \
|
||||||
|
ancestor-quote-bot
|
||||||
|
```
|
||||||
|
|
||||||
|
### Option 3: Use docker-compose.yml (Production)
|
||||||
|
```bash
|
||||||
|
docker compose up -d
|
||||||
|
# Or with custom env:
|
||||||
|
docker compose up -d \
|
||||||
|
-e MATRIX_HOME_SERVER=https://matrix.org \
|
||||||
|
-e MATRIX_ACCESS_TOKEN=your_access_token_here
|
||||||
|
```
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
- `MATRIX_HOME_SERVER`: Your Matrix homeserver URL (e.g., https://matrix.org)
|
| Variable | Description | Default |
|
||||||
- `MATRIX_ACCESS_TOKEN`: Bot access token for authentication
|
|----------|-------------|---------|
|
||||||
- `BOT_COMMAND`: The command trigger (default: `!quote`)
|
| `MATRIX_HOME_SERVER` | Matrix homeserver URL (e.g., https://matrix.org) | https://matrix.org |
|
||||||
|
| `MATRIX_ACCESS_TOKEN` | Bot access token for authentication | REQUIRED |
|
||||||
|
| `BOT_COMMAND` | Command trigger to request a quote | !quote |
|
||||||
|
|
||||||
## Usage
|
## How It Works
|
||||||
|
|
||||||
Type the bot command in any room you've joined, and it will reply with a random Ancestor quote.
|
1. The bot connects to your Matrix homeserver using the provided access token
|
||||||
|
2. Once joined to a room, it listens for messages containing the trigger command
|
||||||
|
3. When triggered, it selects a random quote from `quotes.json` and replies instantly
|
||||||
|
|
||||||
Example:
|
## Getting an Access Token
|
||||||
```
|
|
||||||
Room: #general:matrix.org
|
Use [this](https://matrix.org/docs/projects/registration/matrix-registration-api) or your Matrix admin panel to register a bot account.
|
||||||
!quote
|
|
||||||
Bot: Dispatch this thug in brutal fashion, that all may hear of your arrival!
|
## License
|
||||||
```
|
|
||||||
|
ISC
|
||||||
|
|||||||
Reference in New Issue
Block a user