#! /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" } settings_credentials = { "danbooru_backend": { "username": None, "password": None } } # Basic settings to configure the bot's behavior settings_behavior = { "max_size": 15*1024*1024, "visibility": "unlisted", "feature_set": "pleroma", "sleep_seconds": 1*60*60, "uploads_per_post": 1, "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 = ( "guro", "scat", "yaoi", "implied_yaoi", "bara", "male_focus", "futanari" ) # Apply post settings settings_post = ( setup_profile("danbooru.random", "danbooru_backend", banned_tags, ("random",), "#random", "#random #nsfw #lewd"), setup_profile("danbooru.yandere", "danbooru_backend", banned_tags, ("yandere",), "#yandere", "#yandere #nsfw #lewd"), )