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,
|
|
|
|
"salt": "Generated from create_app.py"
|
|
|
|
}
|
|
|
|
|
|
|
|
settings_credentials = {
|
|
|
|
"danbooru_backend": {
|
|
|
|
"username": None,
|
|
|
|
"password": None
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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",
|
|
|
|
"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"
|
|
|
|
}
|
|
|
|
|
2022-08-30 15:28:03 -07:00
|
|
|
banned_tags = (
|
|
|
|
"guro", "scat", "yaoi", "implied_yaoi", "bara", "male_focus", "futanari"
|
|
|
|
)
|
|
|
|
|
2022-08-29 00:10:06 -07:00
|
|
|
# Apply post settings
|
|
|
|
settings_post = (
|
2022-08-30 22:27:47 -07:00
|
|
|
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"),
|
2022-08-29 00:10:06 -07:00
|
|
|
)
|