Mirai Nikki Bot is designed to be simple to understand (from a technical perspective) and easy to modify/extend. It's main purpose is to pick a random video from a pre-configured list of profiles, and upload a screenshot (at a random point in the video) to your Pleroma account. The render scripts themselves are just shell scripts, making it easy to swap out different command line screenshot utilites that you prefer.
This project is licensed under GPLv3. See [LICENSE.txt](./LICENSE.txt).
The bot is still in development and can easily be crashed by writing a poorly configured `cfg.py` file. It may also crash with encoding errors for files with non-unicode filenames.
## Installing
To setup the python3 environment (for Arch Linux) run the following commands:
If everything worked correctly you should see usage information on Mirai Nikki Bot.
The ./run.sh file will automatically activate and deactivate the python virtual environment. You may want add a symlink to `/usr/local/bin` for convenience.
If you used encryption, everything in the `settings_server` dictionary will be encrypted. If you used encryption and did not specify a keyfile, you will have to enter your password every time you start the bot. Copy and paste these values from the terminal into your `src/cfg.py` file. **Make sure you paste over or delete the placeholder values with the same names.**
- Read [docs/configuration.md](./docs/configuration.md) to customize the bot for your purposes.
- Start the bot with `./run.sh`
- Enter your password if you encrypted your OAuth tokens.
- If you symlinked the file in the [Installing](#installing) section you can simply run `miraiNikkiBot` instead of changing directories and starting the bot with `./run.sh`
- If everything worked correctly, you should see your first image posted to your account.
- Keep in mind that the bot's default visibility setting is set to unlisted for testing. You may want to update it to public.
Most likely you will want this bot to run over a long period of time. There are a several ways to automate calling a script at regular intervals on Linux. For brevity I will be covering the cron way.
First off, install cron if it's not already installed:
If you followed the steps above the cron job should run every 30 minutes at 25 and 55 minutes past the hour. Tail the log file to ensure it's working correctly.
Configuration files for Mirai Nikki Bot are just python files. Because of this we can easily create multiple configurations by importing the main configuration file, and overriding the values we need. This is useful for creating holiday and debug configurations without needing to create a new configuration file from scratch.
```
# Name: alt.py
# Post to an alt account using the exact same settings as the main configuration file
# Run with the following command: ./run.sh -c alt
# cfg.py is the default configuration.
from cfg import *
settings_server = OrderedDict([
("app_name", "generate from ./bin/create_app.py"),
("api_base_url", "generate from ./bin/create_app.py"),
("client_id", "generate from ./bin/create_app.py"),
("client_secret", "generate from ./bin/create_app.py"),
("access_token", "generate from ./bin/create_app.py")
])
settings_reminder = "generate from ./bin/create_app.py"
settings_encrypt = {
"encrypt": False,
"salt": "generate from ./bin/create_app.py"
}
# Uncommenting the below might be useful if your alt is used for debugging and testing
# settings_behavior["visibility"] = "private"
# settings_behavior["debug"] = True
```
```
# Name: xmas.py
# An xmas themed config file!
# Run with the following command: ./run.sh -c xmas