Readme has been written

This commit is contained in:
Fotoente 2022-01-08 19:10:19 +01:00
parent b9b673328d
commit 3ee13d2f6d
2 changed files with 56 additions and 0 deletions

View file

@ -1,2 +1,56 @@
# MIsskey-ebooks-bot
Misskey eBooks Bot with Markov Chain
[Example @roboduck@ente.fun](https://ente.fun/@roboduck)
### 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.
### Installation
To run `mi.py` you must isntall `python3.9` and `python3.9-dev` onto your system.
`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`
For the bot to run you also need two additional packages
```
markovify
configparser
```
or just use the command `pip install -r requirements.txt` in the local folder where you cloned the repo.
### Configuration
To run the bot please edit `example-bot.cfg` and rename it to `bot.cfg`
Following things can be edited:
|Name|Values|Explanation|
|----|----|----|
|instance_read|domain.tld|Put here the domain of the Misskey instance you want to read the notes from. Only domain name and TLD, no `/`,`:` or `https`
|user_read|`username`|The user you want to read the notes from|
|instance_write|domain.tld|Put here the domain of the Misskey instance your bot is running. Only domain name and TLD, no `/`,`:` or `https`
|token|`String`|The token from your bot. Needs right to write notes and read notification|
|notes_count|`interger`|How many posts should be read. Please state a number in 100 increments. Higher number means more variety but also more load when loading those and a bigger RAM consumption. 5000 notes resulted in ~70 MB of RAM used. Default `5000`|
|includeReplies|`boolean`|Should replies included into the markov chain? Default `True`|
|includeMyRenotes|`boolean`|Should the notes you renoted be included? So your bot will make sentences you didn't wrote. Default `false`|
|excludeNsfw|`boolean`|Should be Notes included that are behind a CW Tag? Default `False` (Use with caution! The bot not CW any post he makes!)|
|test_output|`boolean`|Should be the created sentence be tested against the following statements? Default `true` (Highly recomended, otherwise sentences could repeat itself, could be very short or very long.)|
|tries|`integer`|How many times the bot tries to make a sentence that meets the given criteria|
|max_overlap_ratio|`float`|How many pervent of the created sentence is allowed to be the same as the source text. Lower value means more gibberish, higher value to more exact copies of source material. Can be between `0`and `1`. Default `0.6`|
|max_overlap_total|`integer`|How many words are allowed to be the same? Default `15`|
|min_words|`integer`|How many words the sentence must have at least. Default `None`|
|max_words|`integer`|How many words the sentence must have at maximum. Default `None`|
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.
### 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 60 seconds. To prevent that, just mention the bot and he will stay in a loop
## Works on my machine!

2
requirements.txt Normal file
View file

@ -0,0 +1,2 @@
markovify
configparser