Add waifu generator. - annna - Annna the nice friendly bot.
(HTM) git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/annna/
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) Tags
(DIR) README
---
(DIR) commit 0808b26f1bae76ddea35a4c58df74967ae8b94e3
(DIR) parent 2926a2bf9fd14553a4a459ee070ccefbd8cdeaa6
(HTM) Author: Annna Robert-Houdin <annna@bitreich.org>
Date: Fri, 16 Jul 2021 20:45:31 +0200
Add waifu generator.
Diffstat:
M annna-message-common | 7 +++++++
A waifu-gen | 15 +++++++++++++++
2 files changed, 22 insertions(+), 0 deletions(-)
---
(DIR) diff --git a/annna-message-common b/annna-message-common
@@ -466,6 +466,13 @@ case "${text}" in
annna-say -c "${channel}" "${user}, have you tried ${gamelink} ?"
fi
;;
+"${botname}, I need a waifu.")
+ waifuuris="$(waifu-gen)"
+ if [ -n "${waifuuris}" ];
+ then
+ annna-say -c "${channel}" "${user}, ${waifuuris}"
+ fi
+ ;;
"${botname}, I'm gopher bored.")
randomlink="$(/br/bin/bitreich-lawn-random-link)"
linktype="$(printf "%s\n" "${randomlink}" | cut -d '|' -f1 | cut -c2-)"
(DIR) diff --git a/waifu-gen b/waifu-gen
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+totalimages="$(hurl https://www.thiswaifudoesnotexist.net/ \
+ | grep "var totalImages" \
+ | sed 's,.*= \([^;]*\);,\1,')"
+totaltexts="$(hurl https://www.thiswaifudoesnotexist.net/ \
+ | grep "var totalTexts" \
+ | sed 's,.*= \([^;]*\);,\1,')"
+
+randimg="$(shuf -i 1-${totalimages} -n 1)"
+randtext="$(shuf -i 1-${totaltexts} -n 1)"
+
+printf "https://www.thiswaifudoesnotexist.net/example-%s.jpg " "${randimg}"
+printf "https://www.thiswaifudoesnotexist.net/snippet-%s.txt\n" "${randtext}"
+