Introduction
Introduction Statistics Contact Development Disclaimer Help
Add anime generator. - annna - Annna the nice friendly bot.
git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws6…
Log
Files
Refs
Tags
README
---
commit ddc14a8cc698abdd688b281e8f4b3428cd6dfbbd
parent 22d5f043b4b59929fa9f83d0eef112dd6fd1a637
Author: Annna Robert-Houdin <[email protected]>
Date: Fri, 16 Jul 2021 21:10:37 +0200
Add anime generator.
Diffstat:
A anime-gen | 24 ++++++++++++++++++++++++
M annna-message-common | 7 +++++++
2 files changed, 31 insertions(+), 0 deletions(-)
---
diff --git a/anime-gen b/anime-gen
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+animehtml="$(hurl https://thisanimedoesnotexist.ai/)"
+urlbase="$(printf "%s\n" "${animehtml}" \
+ | grep waifuSourceURLBase: \
+ | sed 's,.*: "\([^"]*\)".*,\1,')"
+fileext="$(printf "%s\n" "${animehtml}" \
+ | grep waifuSourceURLFileExtension: \
+ | sed 's,.*: "\([^"]*\)".*,\1,')"
+setsize="$(printf "%s\n" "${animehtml}" \
+ | grep waifuSetSize: \
+ | sed 's,.*: \([^,]*\).*,\1,')"
+leftpadid="$(printf "%s\n" "${animehtml}" \
+ | grep leftPadWaifuIDsWithZeroes: \
+ | sed 's,.*: \([^,]*\).*,\1,')"
+randid="$(shuf -i 1-${setsize} -n 1)"
+
+if [ "${leftpadid}" = "true" ];
+then
+ randid="$(printf "%0*d" "$(($(expr length "${setsize}") - 1))" "${rand…
+fi
+
+printf "%s%s.%s\n" "${urlbase}" "${randid}" "${fileext}"
+
diff --git a/annna-message-common b/annna-message-common
@@ -473,6 +473,13 @@ case "${text}" in
annna-say -c "${channel}" "${user}, ${waifuuris}"
fi
;;
+"${botname}, I need an anime.")
+ animeuri="$(anime-gen)"
+ if [ -n "${animeuri}" ];
+ then
+ annna-say -c "${channel}" "${user}, ${animeuri}"
+ fi
+ ;;
"${botname}, I'm gopher bored.")
randomlink="$(/br/bin/bitreich-lawn-random-link)"
linktype="$(printf "%s\n" "${randomlink}" | cut -d '|' -f1 | cut -c2-)"
You are viewing proxied material from bitreich.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.