<!--
Kemoverse - a gacha-style bot for the Fediverse.
Copyright © 2025 Waifu, VD15 and contributors.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program.  If not, see https://www.gnu.org/licenses/. 
-->

## 🧪 Installation

### Download and install dependencies

Clone the repo

```sh
git clone https://git.waifuism.life/waifu/kemoverse.git
cd kemoverse
```

Setup a virtual environment (Optional, recommended)

```sh
python3 -m venv venv
source venv/bin/activate
```

Install project dependencies via pip

```sh
python3 -m pip install -r requirements.txt
```

### Setup config file

A sample config file is included with the project as a template: `example_config.ini`

Create a copy of this file and replace its' values with your own. Consult the
template for more information about individual config values and their meaning.

Config files are environment-specific. Use `config_dev.ini` for development and
`config_prod.ini` for production. Switch between environments using the
`KEMOVERSE_ENV` environment variable.

```sh
cp example_config.ini config_dev.ini
# Edit config_dev.ini
```

### Setup database

To set up the database, run:

```sh
KEMOVERSE_ENV=dev python3 setup_db.py
```

### Run the bot

```sh
KEMOVERSE_ENV=dev ./startup.sh
```

If all goes well, you should now be able to interact with the bot.

### Running in production

To run the the in a production environment, use `KEMOVERSE_ENV=prod`. You will
also need to create a `config_prod.ini` file and run the database setup step
again if pointing prod to a different database. (you are pointing dev and prod
to different databases, right? 🤨)

### Updating

To update the bot, first pull new changes from upstream:

```sh
git pull
```

Then run any database migrations. We recommend testing in dev beforehand to
make sure nothing breaks in the update process.

**Always backup your prod database before running any migrations!**

```sh
# Backup database file
cp gacha_game_dev.db gacha_game_dev.db.bak
# Run migrations
KEMOVERSE_ENV=dev python3 setup_db.py
```
