update readme

This commit is contained in:
shibao 2022-02-06 13:41:25 -05:00
parent d19c9aecfb
commit 8c259e0be2

View file

@ -3,19 +3,21 @@ Misskey eBooks Bot with Markov Chain
[Example @roboduck@ente.fun](https://ente.fun/@roboduck)
### Introduction
## Introduction
This small python script is a Markov Chain eBooks bot based on the framework of [mi.py](https://github.com/yupix/Mi.py.git)
It can only read and write from and to Misskey. Reading from Mastodon or Pleroma is not (yet) implemented.
It posts every hour on his own and reacts to mentions. Every 12 hours the bot reloads the notes and recalculates the Markov Chain.
### Operating mode
## Operating mode
On the first start up the bot loads a given number of posts into his database and calculates the Markov Chain out of it.
After this he only updates the database with new posts. The upgrading is threaded so the bot itself isn't interrupted while the new markov chain is calulated.
### Installation
To run `mi.py` you must isntall `python3.9` and `python3.9-dev` onto your system. (Please be aware of the requirements for mi.py!)
## Installation
### Host Installation
To run `mi.py` you must install `python3.9` and `python3.9-dev` onto your system. (Please be aware of the requirements for mi.py!)
`mi.py` is still under development and a lot of things change there quickly so please be aware that there could be chances that something changed, that I haven't implemented in the bot at the moment.
to install `mi.py`please use the following command.
`pip install git+https://github.com/yupix/Mi.py.git`
@ -28,9 +30,26 @@ configparser
or just use the command `pip install -r requirements.txt` in the local folder where you cloned the repo.
Before starting the bot, please copy `example-bot.cfg` to `bot.cfg` and
configure it according to the configuration section below.
### Configuration
To run the bot please edit `example-bot.cfg` and rename it to `bot.cfg`
The best way to run it would be a `systemd` unit file and run it as a deamon.
Just to test it you can use `nohup python3.9 rdbot.py &` in the directory the bot is located in.
### Docker
To host this image with docker, copy the `docker-compose.yml` file to the directory that you want to host it from.
Next, you'll need to copy the contents of `example-bot.cfg` to `bot.cfg` in the
same directory and configure it according to the configuration section below.
Run `touch markov.json roboduck.db` in order to create the markov and database
files before starting the docker container. These files must already exist
before starting the docker container.
Then, simply run `docker-compose up` to start the app, or `docker-compose up -d`
to start the bot in detached mode!
## Configuration
Following things can be edited:
|Name|Values|Explanation|
|----|----|----|
@ -52,19 +71,6 @@ Following things can be edited:
You can change the configuration while the bot is running. No restart necessary, they take immediate effect.
### Starting the Bot
The best way to run it would be a `systemd` unit file and run it as a deamon.
Just to test it you can use `nohup python3.9 rdbot.py &` in the directory the bot is located in.
If using docker, first run `touch markov.json roboduck.db` in order to create
the files before starting the docker container. If these files don't exist,
Docker will automatically try to create directories instead.
Then, simply run `docker-compose up --build` to start the app, or
`docker-compose up --build -d` to start the bot in detached mode!
### Known Quirks
## Known Quirks
- The startup needs quite some time. On my system about 10 seconds. You knwo that everything runs well when the first Note is posted.
- When the bot is started, it could happen that he runs in a timeout in the first 600 seconds. To prevent that, just mention the bot and he will stay in a loop.
## Works on my machine!