added cowsay as a service functionality - annna - Annna the nice friendly bot. | |
git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws6… | |
Log | |
Files | |
Refs | |
Tags | |
README | |
--- | |
commit afcd89d7567bfe61a426b186b58f7af3a6de2bed | |
parent 207e3d44db6d6f476903adac2281c83c1f361a2b | |
Author: ben_0x1bi <[email protected]> | |
Date: Sat, 13 Feb 2021 18:08:16 -0500 | |
added cowsay as a service functionality | |
Signed-off-by: Annna Robert-Houdin <[email protected]> | |
Diffstat: | |
M annna-start-services | 9 +++++++++ | |
A cowsayasaservice | 7 +++++++ | |
2 files changed, 16 insertions(+), 0 deletions(-) | |
--- | |
diff --git a/annna-start-services b/annna-start-services | |
@@ -225,6 +225,15 @@ annna_common() { | |
esac | |
annna-say -c "${channel}" "${puri}" | |
;; | |
+ "${botname}, cowsay"*) | |
+ word="$(printf "%s\n" "${text}" | cut -c 13-)" | |
+ tmpf=$(mktemp) | |
+ cowsayasaservice ${word} > ${tmpf} | |
+ if [ $? -eq 0 ]; then | |
+ curi="$(/br/bin/bitreich-paste < ${tmpf})" | |
+ annna-say -c "${channel}" "${user}: the cow said... ${… | |
+ fi | |
+ ;; | |
"${botname}, play despacito plz.") | |
annna-say -c "${channel}" "${user}, gopher://bitreich.org/9/me… | |
;; | |
diff --git a/cowsayasaservice b/cowsayasaservice | |
@@ -0,0 +1,7 @@ | |
+#!/bin/sh | |
+ | |
+if [ $(echo $@ | wc -m) -gt 1 ]; then | |
+ cowsay -f "$(cowsay -l | sed 1d | tr " " "\n" | sort -R | sed 1q)" "$@" | |
+else | |
+ exit 1 | |
+fi |