2022-08-29 00:10:06 -07:00
|
|
|
#! /usr/bin/env python3
|
|
|
|
|
2022-08-31 19:22:23 -07:00
|
|
|
# Danbooru Bot, an image posting bot for Pleroma
|
2022-08-29 00:10:06 -07:00
|
|
|
# Copyright (C) 2022 Anon <yanderefedi@proton.me>
|
|
|
|
#
|
|
|
|
# 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 <https://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
from collections import OrderedDict
|
|
|
|
|
|
|
|
|
2022-08-30 22:27:47 -07:00
|
|
|
def setup_profile(name, backend, banned_tags, tags, message, message_nsfw, force_nsfw=None):
|
2022-08-29 00:10:06 -07:00
|
|
|
post_setting = {
|
|
|
|
"name": name,
|
|
|
|
"backend": backend,
|
|
|
|
"tags": tags,
|
2022-08-30 15:28:03 -07:00
|
|
|
"banned_tags": banned_tags,
|
2022-08-29 15:18:03 -07:00
|
|
|
"message": (message,),
|
2022-08-30 15:28:03 -07:00
|
|
|
"message_nsfw": (message_nsfw,),
|
|
|
|
"force_nsfw": force_nsfw
|
2022-08-29 00:10:06 -07:00
|
|
|
}
|
|
|
|
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,
|
2022-10-08 23:43:44 -07:00
|
|
|
"salt": "Generated from create_app.py",
|
|
|
|
"keyfile": None
|
2022-08-29 00:10:06 -07:00
|
|
|
}
|
|
|
|
|
2022-08-31 19:22:23 -07:00
|
|
|
# Basic settings to configure the bot's behavior
|
2022-08-29 00:10:06 -07:00
|
|
|
settings_behavior = {
|
|
|
|
"max_size": 15*1024*1024,
|
|
|
|
"visibility": "unlisted",
|
|
|
|
"feature_set": "pleroma",
|
|
|
|
"uploads_per_post": 1,
|
2022-10-08 23:43:44 -07:00
|
|
|
"max_errors": 6,
|
2022-08-29 00:10:06 -07:00
|
|
|
"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"
|
|
|
|
}
|
|
|
|
|
2022-10-08 23:43:44 -07:00
|
|
|
banned_tags = (
|
2022-12-18 18:59:56 -08:00
|
|
|
# Gross fetishes
|
|
|
|
"guro", "scat", "amputee", "fisting", "fart",
|
|
|
|
"birth", "inflation", "big_belly", "pregnant",
|
|
|
|
"intestine_bulge", "gigantic_breasts",
|
|
|
|
# Gay/Male Focus
|
2022-10-17 13:06:55 -07:00
|
|
|
"yaoi", "implied_yaoi", "bara", "male_focus", "futanari", "otoko_no_ko",
|
2022-12-18 18:59:56 -08:00
|
|
|
"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
|
2022-10-17 13:06:55 -07:00
|
|
|
"greyscale", "grayscale", "monochrome", "lowres", "comic",
|
2022-12-18 18:59:56 -08:00
|
|
|
"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"
|
2022-10-08 23:43:44 -07:00
|
|
|
)
|
|
|
|
|
2022-09-29 01:17:07 -07:00
|
|
|
settings_backend = {
|
|
|
|
"danbooru_backend": {
|
2022-10-09 22:12:30 -07:00
|
|
|
"module": "danbooru_backend",
|
2022-09-29 01:17:07 -07:00
|
|
|
"username": None,
|
|
|
|
"password": None,
|
|
|
|
"tmp_dir": settings_behavior["tmp_dir"],
|
2022-10-09 22:12:30 -07:00
|
|
|
"max_size": settings_behavior["max_size"],
|
|
|
|
"url": "https://danbooru.donmai.us"
|
|
|
|
},
|
|
|
|
# The below backends are still being tested
|
2022-10-11 23:11:48 -07:00
|
|
|
# Use at your own risk
|
2022-10-09 22:12:30 -07:00
|
|
|
"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"
|
|
|
|
},
|
2022-12-18 18:59:56 -08:00
|
|
|
"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"
|
|
|
|
},
|
2022-10-09 22:12:30 -07:00
|
|
|
"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"
|
|
|
|
},
|
2022-09-29 01:17:07 -07:00
|
|
|
}
|
|
|
|
|
2022-08-30 15:28:03 -07:00
|
|
|
|
2022-08-29 00:10:06 -07:00
|
|
|
# Apply post settings
|
2022-10-11 23:11:48 -07:00
|
|
|
# Post settings consist of a 2d matrix with both the x and y axis increased per post
|
2022-08-29 00:10:06 -07:00
|
|
|
settings_post = (
|
2022-10-17 13:06:55 -07:00
|
|
|
# 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"))
|
2022-08-29 00:10:06 -07:00
|
|
|
)
|