#! /usr/bin/env python3 # Danbooru Bot, an image posting bot for Pleroma # Copyright (C) 2022 Anon # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU 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 General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . from collections import OrderedDict def setup_profile(name, backend, banned_tags, tags, message, message_nsfw, force_nsfw=None): post_setting = { "name": name, "backend": backend, "tags": tags, "banned_tags": banned_tags, "message": (message,), "message_nsfw": (message_nsfw,), "force_nsfw": force_nsfw } return post_setting # Client credentials: >>>NEVER GIVE THESE OUT TO ANYONE<<< # Use the create_app.py script and follow the prompts to generate your tokens. Once generated, copy & paste them below. settings_server = OrderedDict([ ("app_name", "Generated from create_app.py"), ("api_base_url", "Generated from create_app.py"), ("client_id", "Generated from create_app.py"), ("client_secret", "Generated from create_app.py"), ("access_token", "Generated from create_app.py") ]) # settings_reminder = "Generated from create_app.py" settings_reminder = "08/26/2022 08:16PM" # Encryption settings: When using encryption the bot will ask you for your password before logging into your instance. # Use create_app.py and follow the instructions. Select yes when it asks you if you want to encrypt your credentials. # Paste the output below and never change the values. # If you want to encrypt or re-encrypt settings_server you can use encryption.py (or just regenerate your tokens) settings_encrypt = { "encrypt": False, "salt": "Generated from create_app.py", "keyfile": None } # Basic settings to configure the bot's behavior settings_behavior = { "max_size": 15*1024*1024, "visibility": "unlisted", "feature_set": "pleroma", "uploads_per_post": 1, "max_errors": 6, "tag_select": "sequential", "retry_seconds": 15, "content_type": "text/plain", "content_newline": "\n", "post_image_link": False, "tmp_dir": "/tmp", "debug": False } # Time string formats settings_time = { "time_format": "%I:%M%p", "time_format_seconds": "%I:%M:%S%p", "date_format": "%m/%d/%Y", "long_date_format": "%m/%d/%Y %I:%M%p", "long_date_seconds_format": "%m/%d/%Y %I:%M:%S%p", "long_date_week": "%m/%d/%Y %I:%M%p, %A" } banned_tags = ( # Gross fetishes "guro", "scat", "amputee", "fisting", "fart", "birth", "inflation", "big_belly", "pregnant", "intestine_bulge", "gigantic_breasts", # Gay/Male Focus "yaoi", "implied_yaoi", "bara", "male_focus", "futanari", "otoko_no_ko", "shota", "trap", # Beastiality "tentacles", "bestiality", "insect_girl", "scylla", "spider", "spider_girl", "mummification", "mummification_(bound)", "furry", "animal_focus", "no_humans", "cyclops", "android", "robot_joints", "cyborg", "interspecies", # Low Quality "greyscale", "grayscale", "monochrome", "lowres", "comic", "3d", "real_life", "photo_(medium)", "sample_watermark", "traditional_media", # Bad anatomy "anatomical_nonsense", "fewer_digits", "missing_finger", "extra_digits", "extra_breasts", "extra_eyes", "extra_mouth", "extra_heads", "extra_penises", "extra_faces", "extra_legs", "missing_limb", # Bad artists "sath", "sath15" ) settings_backend = { "danbooru_backend": { "module": "danbooru_backend", "username": None, "password": None, "tmp_dir": settings_behavior["tmp_dir"], "max_size": settings_behavior["max_size"], "url": "https://danbooru.donmai.us" }, # The below backends are still being tested # Use at your own risk "konachan_backend": { "module": "konachan_backend", "username": None, "password": None, "tmp_dir": settings_behavior["tmp_dir"], "max_size": settings_behavior["max_size"], "max_depth": 91, "url": "https://konachan.com" }, "yandere_backend": { "module": "konachan_backend", "username": None, "password": None, "tmp_dir": settings_behavior["tmp_dir"], "max_size": settings_behavior["max_size"], "max_depth": 13, "url": "https://yande.re" }, "gelbooru_backend": { "module": "gelbooru_backend", "username": None, "password": None, "tmp_dir": settings_behavior["tmp_dir"], "max_size": settings_behavior["max_size"], "max_depth": 200, "url": "https://gelbooru.com" }, } # Apply post settings # Post settings consist of a 2d matrix with both the x and y axis increased per post settings_post = ( # Random (setup_profile("danbooru.random", "danbooru_backend", banned_tags, ("random",), "#random", "#random #nsfw #lewd"), setup_profile("gelbooru.random", "gelbooru_backend", banned_tags, ("random",), "#random", "#random #nsfw #lewd")), # Yandere (setup_profile("danbooru.yandere", "danbooru_backend", banned_tags, ("yandere",), "#yandere", "#yandere #nsfw #lewd"), setup_profile("gelbooru.yandere", "gelbooru_backend", banned_tags, ("yandere",), "#yandere", "#yandere #nsfw #lewd")) )