FediStatusPosterExtras/imgbot.sh

128 lines
5.7 KiB
Bash
Raw Normal View History

2024-03-09 18:29:43 -08:00
#! /usr/bin/env sh
# FediStatusPoster - Simple CLI tools and scripts to post to the fediverse
# Copyright (C) 2024 <@Anon@yandere.cc>
#
# 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/>.
# Get the runtime path of the bot
ABS_PATH="$(readlink -f "$0")"
RUN_DIR="$(dirname "$ABS_PATH")"
ENTRY="${RUN_DIR}/../FediStatusPoster/runconfig.sh"
[ ! $# -ge 1 ] &&\
echo "Invalid number of arguments..." &&\
echo "$(basename "$0") [path] [options...] usage:" &&\
echo " path - path to image file to post" &&\
echo " options - additional arguments or switches to pass to fedistatusposter" &&\
exit 1
PICKED="$1"
TEXT=
NSFW="--safe"
DEFAULT_CREDENTIALS=
DEFAULT_KEYFILE=
shift
case "$PICKED" in
*/rsc/YandereLewdBot/*)
DEFAULT_CREDENTIALS="${RUN_DIR}/credentials/yanderelewdbot.sh.gpg"
DEFAULT_KEYFILE='/zfs_media/fs1/BotKeys/yanderelewdbot.sh.key'
;;
*/rsc/FutureDiary/*)
DEFAULT_CREDENTIALS="${RUN_DIR}/credentials/futurediary.sh.gpg"
DEFAULT_KEYFILE='/zfs_media/fs1/BotKeys/futurediary.sh.key'
;;
*/rsc/HappySugarLife/*)
DEFAULT_CREDENTIALS="${RUN_DIR}/credentials/happysugarlife.sh.gpg"
DEFAULT_KEYFILE='/zfs_media/fs1/BotKeys/happysugarlife.sh.key'
;;
*/rsc/Netoge/*)
DEFAULT_CREDENTIALS="${RUN_DIR}/credentials/netoge.sh.gpg"
DEFAULT_KEYFILE='/zfs_media/fs1/BotKeys/netoge.sh.key'
;;
esac
case "$PICKED" in
*/rsc/*/*/safe/*)
case "$PICKED" in
# Yandere Lewd Bot
*/rsc/YandereLewdBot/__Random/safe/*) TEXT="#yandere";;
*/rsc/YandereLewdBot/yangire/safe/*) TEXT="#yangire";;
*/rsc/YandereLewdBot/rena/safe/*) TEXT="#Rena_Ryuuguu #yangire";;
*/rsc/YandereLewdBot/Ayase/safe/*) TEXT="#Ayase_Aragaki #yandere";;
*/rsc/YandereLewdBot/Yandereloid/safe/*) TEXT="#Yandereloid #yandere";;
*/rsc/YandereLewdBot/Kotonoha/safe/*) TEXT="#Kotonoha_Katsura #School_Days #yandere";;
*/rsc/YandereLewdBot/Yuri/safe/*) TEXT="#yuri #yandere";;
*/rsc/YandereLewdBot/HappySugarLife/safe/*) TEXT="#Happy_Sugar_Life #yandere";;
*/rsc/YandereLewdBot/Ako/safe/*) TEXT="#Ako_Tamaki #yandere";;
*/rsc/YandereLewdBot/DDLC/safe/*) TEXT="#DDLC #yandere";;
*/rsc/YandereLewdBot/kurumi/safe/*) TEXT="#Kurumi_Tokisaki #yangire";;
*/rsc/YandereLewdBot/Tei/safe/*) TEXT="#Sukone_Tei #Scottei #yandere";;
*/rsc/YandereLewdBot/Yuno/safe/*) TEXT="#Yuno_Gasai #yandere";;
*/rsc/YandereLewdBot/Anna/safe/*) TEXT="#Anna_Nishikinomiya #yandere";;
*/rsc/YandereLewdBot/Toga/safe/*) TEXT="#Himiko_Toga #yangire";;
*/rsc/YandereLewdBot/Albedo/safe/*) TEXT="#Albedo #yandere";;
*/rsc/YandereLewdBot/Yancolle/safe/*) TEXT="#yandere";;
*/rsc/YandereLewdBot/meme/safe/*) TEXT="#yandere #meme";;
*/rsc/YandereLewdBot/Kiyohime/safe/*) TEXT="#Kiyohime #yandere";;
*/rsc/YandereLewdBot/Taihou/safe/*) TEXT="#yandere";;
# Frame Bots
*/rsc/FutureDiary/*/safe/*) TEXT="#Future_Diary #yandere";;
*/rsc/HappySugarLife/*/safe/*) TEXT="#Happy_Sugar_Life #yandere";;
*/rsc/Netoge/*/safe/*) TEXT="#Netoge #yandere";;
esac
;;
*/rsc/*/*/nsfw/*)
NSFW='--nsfw'
case "$PICKED" in
*/rsc/YandereLewdBot/__Random/nsfw/*) TEXT="#nsfw #lewd #yandere";;
*/rsc/YandereLewdBot/yangire/nsfw/*) TEXT="#nsfw #lewd #yangire";;
*/rsc/YandereLewdBot/rena/nsfw/*) TEXT="#Rena_Ryuuguu #nsfw #yangire";;
*/rsc/YandereLewdBot/Ayase/nsfw/*) TEXT="#Ayase_Aragaki #nsfw #yandere";;
*/rsc/YandereLewdBot/Yandereloid/nsfw/*) TEXT="#Yandereloid #nsfw #yandere";;
*/rsc/YandereLewdBot/Kotonoha/nsfw/*) TEXT="#Kotonoha_Katsura #nsfw #yandere";;
*/rsc/YandereLewdBot/Yuri/nsfw/*) TEXT="#yuri #nsfw #yandere";;
*/rsc/YandereLewdBot/HappySugarLife/nsfw/*) TEXT="#Happy_Sugar_Life #nsfw #yandere";;
*/rsc/YandereLewdBot/Ako/nsfw/*) TEXT="#Ako_Tamaki #nsfw #yandere";;
*/rsc/YandereLewdBot/DDLC/nsfw/*) TEXT="#DDLC #nsfw #yandere";;
*/rsc/YandereLewdBot/kurumi/nsfw/*) TEXT="#Kurumi_Tokisaki #nsfw #yangire";;
*/rsc/YandereLewdBot/Tei/nsfw/*) TEXT="#Sukone_Tei #Scottei #nsfw #yandere";;
*/rsc/YandereLewdBot/Yuno/nsfw/*) TEXT="#Yuno_Gasai #nsfw #yandere";;
*/rsc/YandereLewdBot/Anna/nsfw/*) TEXT="#Anna_Nishikinomiya #nsfw #yandere";;
*/rsc/YandereLewdBot/Toga/nsfw/*) TEXT="#Himiko_Toga #nsfw #yangire";;
*/rsc/YandereLewdBot/Albedo/nsfw/*) TEXT="#Albedo #nsfw #yandere";;
*/rsc/YandereLewdBot/Yancolle/nsfw/*) TEXT="#nsfw #lewd #yandere";;
*/rsc/YandereLewdBot/meme/nsfw/*) TEXT="#nsfw #yandere #meme";;
*/rsc/YandereLewdBot/Kiyohime/nsfw/*) TEXT="#Kiyohime #nsfw #yandere";;
*/rsc/YandereLewdBot/Taihou/nsfw/*) TEXT="#nsfw #lewd #yandere";;
# Frame Bots
*/rsc/FutureDiary/*/nsfw/*) TEXT="#Future_Diary #yandere #nsfw";;
*/rsc/HappySugarLife/*/safe/*) TEXT="#Happy_Sugar_Life #yandere #nsfw";;
*/rsc/Netoge/*/safe/*) TEXT="#Netoge #yandere #nsfw";;
esac
;;
esac
[ -z "$TEXT" ] && echo "Error, no profile found: ${PICKED}" && exit 1
case "$PICKED" in
*.txt)
cat "$PICKED" | "$ENTRY" "$DEFAULT_CREDENTIALS" "$DEFAULT_KEYFILE" "$NSFW" "$@" "$TEXT" '-';;
*)
"$ENTRY" "$DEFAULT_CREDENTIALS" "$DEFAULT_KEYFILE" "$NSFW" "$@" "$TEXT" "$PICKED";;
esac