2024-07-09 02:54:42 +00:00
# Veloren Trading Bot
A bot that buys, sells and trades with players.
2024-07-11 08:30:20 +00:00
The bot is containerized and can be run without compiling or building anything. Alternatively, you can clone this repository and build the image yourself or build the binary directly with Cargo if you are familiar with Rust.
## Prerequisites
2024-07-09 02:54:42 +00:00
2024-07-11 08:30:20 +00:00
You must have either [Docker ](docker.com ) or [Podman ](podman.io ) installed.
2024-07-09 02:54:42 +00:00
2024-07-11 08:30:20 +00:00
## Usage
2024-07-09 02:54:42 +00:00
2024-07-11 08:30:20 +00:00
All of these steps can be done with Docker but Podman is shown for the examples. If you use Docker, just replace "podman" with "docker" in your commands.
### Setup
2024-07-09 02:54:42 +00:00
Create a "secrets.toml" file:
```toml
# secrets.toml
2024-07-11 08:30:20 +00:00
username = "bot_username"
password = "bot_password"
character = "bot_character"
admins = ["my_username"]
2024-07-09 02:54:42 +00:00
```
Then create a secret to pass the file securely to the container.
```sh
podman secret create secrets.toml secrets.toml
```
2024-07-11 08:30:20 +00:00
You will also need a "config.toml" and it needs it be in a "config" directory that can be mounted to the container:
2024-07-09 02:54:42 +00:00
```toml
2024-07-11 08:30:20 +00:00
# config/config.toml
position = [0, 0, 0] # Change these to the desired X, Y, Z coordinates
orientation = 0 # 0 = North, 90 = West, 180 = South, 270 = East
2024-07-09 02:54:42 +00:00
[buy_prices]
2024-07-11 08:30:20 +00:00
"food.cheese" = 50
2024-07-09 02:54:42 +00:00
[sell_prices]
2024-07-11 08:30:20 +00:00
"consumable.potion_minor" = 150
2024-07-09 02:54:42 +00:00
```
2024-07-11 08:30:20 +00:00
### Running
2024-07-09 02:54:42 +00:00
2024-07-11 08:30:20 +00:00
Run the container:
2024-07-09 02:54:42 +00:00
```sh
podman run \
2024-07-11 08:30:20 +00:00
--detach \
--name trade_bot \
2024-07-09 02:54:42 +00:00
--secret secrets.toml \
-v ./config/:/root/config/ \
--env CONFIG=/root/config/config.toml \
--env SECRETS=/run/secrets/secrets.toml \
--env RUST_LOG=trade_bot \
git.jeffa.io/jeff/trade_bot
```
2024-07-11 08:30:20 +00:00
View the log output with `podman logs -f trade_bot` .
2024-07-09 02:54:42 +00:00
### Building
2024-07-11 08:30:20 +00:00
Clone this repository. From the project root:
2024-07-09 02:54:42 +00:00
```sh
podman build . -t trade_bot
```
2024-07-11 08:30:20 +00:00
Then follow the [above ](#running ) steps with the tag "trade_bot" instead of "git.jeffa.io/jeff/trade_bot".
2024-07-11 15:43:52 +00:00
### In-Game Commands
The bot is able to respond to the following commands, which must be sent via "/tell".
- `price [search term]` : Returns the buy/sell offers of any item whose item definition ID contains the search term.
- `admin_access` : Admin-only, prompts the bot to send a trade invite, after which it will give away and accept any items until the trade ends.
- `sort [count (optional)]` : Admin-only, sorts the inventory once or the given number of times.