# Readme Yandere Lewd Bot is a customizable, no frills image-posting bot for Pleroma. A live example can be viewed at [Neckbeard.xyz](https://neckbeard.xyz/YandereLewdBot). Currently the bot will only run on Linux. I believe it should run on most distros but I have only tested it on Arch and Raspbian. ## Usage ```text usage: main.py [--dry-run] [--debug] [-w WAIT] [-t TIME] [-d DATE] [-c CONFIG] [-o] [-h] A bot for posting on Mastodon optional arguments: --dry-run Will not login or post to Plemora --debug Same as --dry-run -w WAIT, --wait WAIT Wait before posting first image (seconds) -t TIME, --time TIME Wait for time before posting first image -d DATE, --date DATE Wait for date before posting first image -c CONFIG, --config CONFIG Set custom config file (Default: cfg) -o, --output-hashes Output list of hashes -h, --help Show this help message and exit TIME %I:%M%p 03:58PM DATE %m/%d/%Y 11/26/2021 ``` ## About Yandere Lewd Bot is designed to be simple to understand (from a technical perspective) and easy to modify/extend. Yandere Lewd Bot relies on GNU formatted hash files to configure and organize posts (from the GNU coreutils package): (ex. `26d00a6ee5ae8fa3d58ee44b32b8992f *./rsc/nsfw/image.jpg`) The bot is still in development and can easily be crashed by writing a poorly configured `cfg.py` file, or messing with the hash files it uses to configure posts. ## Installing To setup the python3 environment (for Arch Linux) run the following commands: ``` sudo pacman -Syu sudo pacman -S --needed python git git clone 'https://github.com/YandereLewdBot/YandereLewdBot.git' cd yandereLewdBot/ python -m venv venv source ./venv/bin/activate pip install --upgrade pip pip install -r requierements.txt deactivate cp ./bin/cfg_default.py ./bin/cfg.py "./md5/master_file.txt" ``` ## Installing Screen Most likely, you will want this bot to run over a long period of time. It is probobly best to install the `screen` package for Linux so you don't have to have a terminal window constantly open (especially if you are running it from a remote machine such as a Raspberry Pi or server). ``` sudo pacman -Syu sudo pacman -S --needed screen # Screen cheatsheet # To create a new screen session named 'yandereLewdBot' screen -S yandereLewdBot # To detach from the screen session Ctrl+a d # To reconnect to the screen session screen -r yandereLewdBot # List screen sessions screen -ls # Kill the screen session Ctrl+a k y # Scroll back Ctrl+a ESC Page Up # End scroll back ESC ``` ## A More Useful rsc/ Folder Structure A more advanced (and useful) way of organizing images in the `rsc/` folder is by date added, group (such as a character name like Yuno Gasai), and safe/nsfw profiles. To do this, the following folder structure would be used: `rsc/year.month.day/character/safe_or_nsfw/image.png` To configure this in the `settings_post` section, use the following for safe/nsfw repectivly: ``` setup_safe_profile("Yuno.safe", "./rsc/*/Yuno/safe/*", "#Yuno_Gasai #yandere") setup_nsfw_profile("Yuno.nsfw", "./rsc/*/Yuno/nsfw/*", "#Yuno_Gasai #nsfw #yandere") ``` Notice the wildcard character `'*'` is used in place of year.month.day. This will match any folder in the resource folder, and all of our folders will be in order of when we added them. ## A Master Blacklist The default configuration file has the following settings below (these files will not exist by default. The bot will simply ignore blacklist hash files that it can't open). The _r stands for read and the _w stands for write. This will ensure that the master_blacklist.txt is always read, but is never written to. This is intended for the user to manually add GNU formatted hashes to master_blacklist.txt in case they want to make especially sure that hashes and paths that are matched in the list are never uploaded accidentally. ``` "master_blacklist_r": ("./md5/blacklist.txt", "./md5/master_blacklist.txt"), "master_blacklist_w": ("./md5/blacklist.txt",), ``` ## Quickly Create Configuration Files Configuration files for Yandere Lewd 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. You should set this to whatever you are overriding. 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" } settings_behavior["master_blacklist_r"] = ("./md5/blacklist_alt.txt", "./md5/master_blacklist.txt") settings_behavior["master_blacklist_w"] = ("./md5/blacklist_alt.txt",) # Uncommenting the below might be useful if your alt is used for debugging and testing # settings_behavior["master_list"] = ("master_file_alt.txt",) # settings_behavior["visibility"] = "private" # settings_behavior["debug"] = True # settings_behavior["master_blacklist_w"] = tuple() ``` ``` # Name: xmas.py # An xmas themed config file! # Run with the following command: ./run.sh -c xmas # cfg.py is the default configuration. You should set this to whatever you are overriding. from cfg import * settings_behavior["master_list"] = ("./md5/event_xmas.txt",) settings_behavior["master_blacklist_r"] = ("./md5/blacklist_xmas.txt", "master_blacklist.txt") settings_behavior["master_blacklist_w"] = ("./md5/blacklist_xmas.txt",) # Prepend '#Merry #Christmas' to the beginning of the first line in each post for setting in settings_post: if len(setting["message"]) and issubclass(type(setting["message"][0]), str): new_msg = "#Merry #Christmas {}".format(setting["message"][0]) setting["message"] = (new_msg,) + setting["message"][1:] ```