Introduction
Introduction Statistics Contact Development Disclaimer Help
Annna is a woman now. She listens on all channels. - annna - Annna the nice fri…
git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws6…
Log
Files
Refs
Tags
README
---
commit 7d52d331bf02f2b674bb6a697c71c68987826e34
parent 7508bcc3337150305f3850897b994a2a8f951bd6
Author: Annna Robert-Houdin <[email protected]>
Date: Wed, 13 May 2020 19:44:19 +0200
Annna is a woman now. She listens on all channels.
Diffstat:
M annna-start-services | 1254 ++++++++++++++++-------------…
1 file changed, 641 insertions(+), 613 deletions(-)
---
diff --git a/annna-start-services b/annna-start-services
@@ -30,689 +30,717 @@ regeximatch() {
printf '%s' "$1" | grep -i -E -q "$2"
}
-# Permissions
-[ -d ${iiroot} ] && chmod o+rx ${iiroot}
-[ -d ${iibase} ] && chmod o+rx ${iibase}
-## EN Channel (this script)
-[ -d "${iibase}/#bitreich-en" ] \
- && chmod o+rx "${iibase}/#bitreich-en"
-[ -p "${iibase}/#bitreich-en/in" ] \
- && chmod o+w "${iibase}/#bitreich-en/in"
-## SCM (/scm/post-receive)
-[ -d "${iibase}/#bitreich-scm" ] \
- && chmod o+rx "${iibase}/#bitreich-scm"
-[ -p "${iibase}/#bitreich-scm/in" ] \
- && chmod o+w "${iibase}/#bitreich-scm/in"
-## Radio (/br/radio/playlist.sh + this script)
-[ -d "${iibase}/#bitreich-radio" ] \
- && chmod o+rx "${iibase}/#bitreich-radio"
-[ -p "${iibase}/#bitreich-radio/in" ] \
- && chmod o+w "${iibase}/#bitreich-radio/in"
-
-if [ -f "${iibase}/#bitreich-radio/out" ];
-then
-# bitreich-radio
-{
- ls "${iibase}/#bitreich-radio/out" | entr tail -n 1 "${iibase}/#bitrei…
- | grep -v --line-buffered '[0-9]* -!- ' \
- | sed -u 's,[0-9]* <\([^ >]*\)> \(.*\),\1\n\2,' \
- | {
- while read -r user;
- do
- read -r text
-
- [ "$user" = "${botname}" ] && continue
-
- if [ "${text}" = "${botname}, next please." ];
- then
- /br/bin/bitreich-radio-playlist-next
- annna-say -c "#bitreich-radio" "You are very kind ${us…
- continue;
- fi
-
- if [ "${text}" = "${botname}, please help." ];
- then
- annna-say -c "${user}" "»next please.« gets the play…
- annna-say -c "${user}" "»please help.« gives you thi…
- continue;
- fi
- done
- }
-} &
-fi
-
-# bitreich-en
-if [ -f "${iibase}/#bitreich-en/out" ];
-then
-{
- ls "${iibase}/#bitreich-en/out" | entr tail -n 1 "${iibase}/#bitreich-…
- | grep -v --line-buffered '[0-9]* -!- ' \
- | sed -u 's,[0-9]* <\([^ >]*\)> \(.*\),\1\n\2,' \
- | {
- while read -r user;
- do
- read -r text
- [ "$user" = "${botname}" ] && continue
-
- uri="$(printf "%s\n" "${text}" \
- | sed -n '/.*\(https\{0,1\}:\/\/[^ ]\{1,\}\).*/s//\1/p…
- case "${text}" in
- *\#nospoil*)
- ;;
- *)
- if [ -n "$uri" ];
+annna_common() {
+ channel="$1"
+ user="$2"
+ text="$3"
+
+ printf "annna_common: %s %s %s\n" "${channel}" "${user}" "${text}"
+
+ [ "$user" = "${botname}" ] && return
+
+ uri="$(printf "%s\n" "${text}" \
+ | sed -n '/.*\(https\{0,1\}:\/\/[^ ]\{1,\}\).*/s//\1/p')"
+ case "${text}" in
+ *\#nospoil*)
+ ;;
+ *)
+ if [ -n "$uri" ];
+ then
+ tmpf=$(mktemp)
+ fetch-url "${uri}" > "${tmpf}"
+ urititle="$(grabtitle < "${tmpf}" | sed 's/^ *\(.\{0,2…
+ # TODO: Replace all of this with a better logic for pa…
+ if [ -n "$urititle" ];
then
- tmpf=$(mktemp)
- fetch-url "${uri}" > "${tmpf}"
- urititle="$(grabtitle < "${tmpf}" | sed 's/^ *…
- # TODO: Replace all of this with a better logi…
- if [ -n "$urititle" ];
- then
- case "${urititle}" in
- *Gunther*|*GUNTHER*|*G�nther*)
- annna-say -c "#bitreich-en" "O…
- ;;
- *\|\ Cloudflare*)
- annna-say -c "#bitreich-en" "M…
- ;;
- *)
- if expr "${uri}" : '^https*://…
+ case "${urititle}" in
+ *Gunther*|*GUNTHER*|*G�nther*)
+ annna-say -c "${channel}" "Oh Gunther!…
+ ;;
+ *\|\ Cloudflare*)
+ annna-say -c "${channel}" "Mind your o…
+ ;;
+ *)
+ if expr "${uri}" : '^https*://[^/]*you…
+ then
+ spurl="$(subtitle-paste "${uri…
+ if [ -n "${spurl}" ];
then
- spurl="$(subtitle-past…
- if [ -n "${spurl}" ];
- then
- annna-say -c "…
- else
- annna-say -c "…
- fi
+ annna-say -c "${channe…
else
- wikipedia=0
- case "${uri}" in
- *twitter.com*)
- nurl="$(printf…
- spurl="$(scree…
- annna-say -c '…
-
- ;;
- *en.wikipedia.org/wiki…
- if ! regeximat…
- nurl="…
- purl="…
- annna-…
- # Hack…
- wikipe…
- fi
- ;;
- *www.reddit.com*)
- nurl="$(printf…
+ annna-say -c "${channe…
+ fi
+ else
+ wikipedia=0
+ case "${uri}" in
+ *twitter.com*)
+ nurl="$(printf "%s\n" …
+ spurl="$(screenshot-pa…
+ annna-say -c "${channe…
+
+ ;;
+ *en.wikipedia.org/wiki*)
+ if ! regeximatch "$uri…
+ nurl="$(printf…
purl="$(9 html…
- if [ -n "${uri…
- subred…
- post="…
- if [ -…
- …
- else
- …
- fi
- annna-…
- else
- annna-…
- fi
+ annna-say -c "…
# Hack, Hack, …
wikipedia=1
- ;;
- *)
- spurl=""
- ;;
- esac
-
- if [ $wikipedia -eq 0 …
- then
- purl="$(9 html…
- if [ -n "${spu…
- then
- annna-…
+ fi
+ ;;
+ *www.reddit.com*)
+ nurl="$(printf '%s\n' …
+ purl="$(9 htmlfmt < "$…
+ if [ -n "${uri#*www.re…
+ subreddit="$(p…
+ post="$(printf…
+ if [ -n "${pos…
+ gurl="…
else
- annna-…
+ gurl="…
fi
+ annna-say -c "…
+ else
+ annna-say -c "…
+ fi
+ # Hack, Hack, Hack.
+ wikipedia=1
+ ;;
+ *)
+ spurl=""
+ ;;
+ esac
+
+ if [ $wikipedia -eq 0 ];
+ then
+ purl="$(9 htmlfmt < "$…
+ if [ -n "${spurl}" ];
+ then
+ annna-say -c "…
+ else
+ annna-say -c "…
fi
fi
- ;;
- esac
- fi
- rm -f "${tmpf}"
- continue
+ fi
+ ;;
+ esac
fi
+ rm -f "${tmpf}"
+ return
+ fi
+ ;;
+ esac
+
+ case "${text}" in
+ "${botname}, what is "*)
+ word="$(printf "%s\n" "${text}" | cut -c 16-)"
+ case "$word" in
+ *\?)
+ word="$(printf "%s\n" "${word}" | cut -c -"$(($(expr l…
;;
esac
- case "${text}" in
- "${botname}, what is "*)
- word="$(printf "%s\n" "${text}" | cut -c 16-)"
- case "$word" in
- *\?)
- word="$(printf "%s\n" "${word}" | cut -c -"$((…
- ;;
- esac
-
- purl=""
+ purl=""
+ dresult="$(dict "dict://parazyd.org/d:${word}")"
+ derr=$?
+ if [ $derr -eq 20 ];
+ then
dresult="$(dict "dict://parazyd.org/d:${word}")"
- derr=$?
- if [ $derr -eq 20 ];
- then
- dresult="$(dict "dict://parazyd.org/d:${word}"…
- derr2="$?"
- [ $derr2 -ne $derr ] && derr=$derr2
- fi
- case "$derr" in
- 0|21)
- purl="$(printf "%s" "${dresult}" | /br/bin/bit…
- ;;
- 20)
- purl="No matches found."
- ;;
- 1)
- purl="Parse error."
+ derr2="$?"
+ [ $derr2 -ne $derr ] && derr=$derr2
+ fi
+ case "$derr" in
+ 0|21)
+ purl="$(printf "%s" "${dresult}" | /br/bin/bitreich-pa…
+ ;;
+ 20)
+ purl="No matches found."
+ ;;
+ 1)
+ purl="Parse error."
+ ;;
+ *)
+ purl="Parazyd destroyed the server. Nothing to see her…
+ ;;
+ esac
+ annna-say -c "${channel}" "${purl}"
+ ;;
+ "${botname}, wolfram is "*)
+ word="$(printf "%s\n" "${text}" | cut -c 19- | sed 's,\t, ,…
+ case "$word" in
+ *\?)
+ word="$(printf "%s\n" "${word}" | cut -c -"$(($(expr l…
+ ;;
+ esac
+
+ purl=""
+ dresult="$(printf "/wolfram\t%s\r\n" "${word}" \
+ | nc magical.fish 70 \
+ | awk '/iAnswer:/,/iAsk/' \
+ | grep -v '^i ' \
+ | head -n -1 \
+ | tail -n +2 \
+ | sed 's,i\(.*\)fake\texample.com.*,\1,;s,[ \t]*$,,')"
+
+
+ if [ -n "$dresult" ];
+ then
+ case "${dresult}" in
+ b*)
+ dresult="$(printf "%s\n" "${dresult}" \
+ | tr '\n' ' ' \
+ | sed "s,^b',,;s,' $,," \
+ | sed 's,^b",,;s," $,,' \
+ | sed 's,\\n,\n,g;s,\\t,\t,g')"
;;
*)
- purl="Parazyd destroyed the server. Nothing to…
+ dresult="$(printf "%s\n" "${dresult}" \
+ | sed 's,\([a-zA-Z]\)$,\1 ,' \
+ | tr -d '\n')"
;;
esac
- annna-say -c '#bitreich-en' "${purl}"
- ;;
- "${botname}, wolfram is "*)
- word="$(printf "%s\n" "${text}" | cut -c 19- | sed 's,…
- case "$word" in
- *\?)
- word="$(printf "%s\n" "${word}" | cut -c -"$((…
- ;;
- esac
-
- purl=""
- dresult="$(printf "/wolfram\t%s\r\n" "${word}" \
- | nc magical.fish 70 \
- | awk '/iAnswer:/,/iAsk/' \
- | grep -v '^i ' \
- | head -n -1 \
- | tail -n +2 \
- | sed 's,i\(.*\)fake\texample.com.*,\1,;s,[ \t…
+ wcl="$(printf "%s" "${dresult}" | wc -l)"
- if [ -n "$dresult" ];
+ if [ $wcl -gt 1 ];
then
- case "${dresult}" in
- b*)
- dresult="$(printf "%s\n" "${dresult}" \
- | tr '\n' ' ' \
- | sed "s,^b',,;s,' $,," \
- | sed 's,^b",,;s," $,,' \
- | sed 's,\\n,\n,g;s,\\t,\t,g')"
- ;;
- *)
- dresult="$(printf "%s\n" "${dresult}" \
- | sed 's,\([a-zA-Z]\)$,\1 ,' \
- | tr -d '\n')"
- ;;
- esac
-
- wcl="$(printf "%s" "${dresult}" | wc -l)"
-
- if [ $wcl -gt 1 ];
- then
- purl="$(printf "%s" "${dresult}" | /br…
- else
- purl="${dresult}"
- fi
+ purl="$(printf "%s" "${dresult}" | /br/bin/bit…
else
- purl="No matches found."
+ purl="${dresult}"
fi
- annna-say -c '#bitreich-en' "${purl}"
- ;;
- "${botname}, textsynth is "*)
- word="$(printf "%s\n" "${text}" | cut -c 21- | sed 's,…
- case "$word" in
- *\?)
- word="$(printf "%s\n" "${word}" | cut -c -"$((…
- ;;
- esac
-
- # Do in background, because read is very slow.
- {
- dresult="$(textsynth-complete "${word}")"
- if [ -n "${dresult}" ];
- then
- purl="$({
- # First the old words.
- printf "%s" "${word}";
- # then the generated text.
- printf "%s" "${dresult}";
- } | /br/bin/bitreich-paste)"
- else
- purl="Textsynth did not answer."
- fi
- annna-say -c '#bitreich-en' "textsynth result:…
- } &
-
- ;;
- "${botname}, are "*)
- case "${text}" in
- *" in love?")
- words="$(printf "%s\n" "${text}" | sed 's,.*ar…
- lovedistance="$(printf "%s * 100\n" "$(fstrcmp…
- if [ $lovedistance -gt 15 ];
- then
- annna-say -c '#bitreich-en' 'Yes!!! Pu…
- else
- annna-say -c '#bitreich-en' "No."
- fi
- ;;
- esac
- ;;
- esac
-
- case "${text}" in
- "${botname}, please turn on "*)
- word="$(printf "%s\n" "${text}" | cut -c 22-)"
- annna-say -c '#bitreich-en' "☞ ⏻ ${word}"
- ;;
- "${botname}, please turn me on.")
- annna-say -c '#bitreich-en' "☞ ⏻ ${user}"
+ else
+ purl="No matches found."
+ fi
+ annna-say -c "${channel}" "${purl}"
+ ;;
+ "${botname}, textsynth is "*)
+ word="$(printf "%s\n" "${text}" | cut -c 21- | sed 's,\t, ,…
+ case "$word" in
+ *\?)
+ word="$(printf "%s\n" "${word}" | cut -c -"$(($(expr l…
;;
esac
- if [ "${text}" = "${botname}, I'm bored." ];
- then
- randomlink="$(/br/bin/bitreich-lawn-random-link)"
- linktype="$(printf "%s\n" "${randomlink}" | cut -d '|'…
- linktext="$(printf "%s\n" "${randomlink}" | cut -d '|'…
- linksel="$(printf "%s\n" "${randomlink}" | cut -d '|' …
- linkserver="$(printf "%s\n" "${randomlink}" | cut -d '…
- linkport="$(printf "%s\n" "${randomlink}" | cut -d '|'…
- outtext="$(printf "%s - gopher://%s" "$linktext" "$lin…
- if [ "$linkport" != "70" -a "$linkport" != "port" ];
- then
- outtext="$(printf "%s:%s" "$outtext" "$linkpor…
- fi
- if [ -n "$linksel" ];
+ # Do in background, because read is very slow.
+ {
+ dresult="$(textsynth-complete "${word}")"
+ if [ -n "${dresult}" ];
then
- outtext="$(printf "%s/%s%s" "$outtext" "$linkt…
+ purl="$({
+ # First the old words.
+ printf "%s" "${word}";
+ # then the generated text.
+ printf "%s" "${dresult}";
+ } | /br/bin/bitreich-paste)"
+ else
+ purl="Textsynth did not answer."
fi
- annna-say -c "#bitreich-en" "$outtext"
- fi
-
- if [ "${text}" = "${botname}, what's up?" ];
- then
- newsstr="$(ecl -shell /home/solene/gopher/bin/generato…
- annna-say -c "#bitreich-en" "$newsstr"
- continue;
- fi
-
- if [ "${text}" = "${botname}, I feel sick." ];
- then
- newsstr="$(cd /br/gopher/hypochondria && ./hypochondri…
- annna-say -c "#bitreich-en" "You could have ${newsstr}…
- continue;
- fi
+ annna-say -c "${channel}" "textsynth result: ${purl}"
+ } &
- if [ "${text}" = "${botname}, oh hai!" ];
- then
- annna-say -c "#bitreich-en" "${user}, hai! How is your…
- continue;
- fi
-
- if [ "${text}" = "${botname}, please tech hype me." ];
- then
- techstr="$(${modbase}/markov_tech/markov)"
- annna-say -c "#bitreich-en" "${techstr}"
- continue;
- fi
-
- if [ "${text}" = "${botname}, what's my horoscope?" ];
- then
- horostr="$($HOME/scm/bullshit/horoscope)"
- annna-say -c "#bitreich-en" "${user}, ${horostr}"
- continue;
- fi
-
- if [ "${text}" = "${botname}, what's my future?" ];
- then
- purl="$(sacc gopher://parazyd.org/0/tarot.cgi | /br/bi…
- annna-say -c "#bitreich-en" "${user}, your future is h…
- continue;
- fi
-
- randomtag=0
- if [ "${text}" = "${botname}, please meme meme meme me." ];
- then
- randomtag=2
- fi
-
- if [ "${text}" = "${botname}, what's the wheelchair shooter me…
- then
- tagname="#scrollby"
- tagline="$(printf "%s\n" "$(hashtags)" | grep "^${tagn…
- tagname="$(printf "%s\n" "${tagline}" | cut -d ' ' -f …
- taguri="$(printf "%s\n" "${tagline}" | cut -d ' ' -f 2…
- annna-say -c "#bitreich-en" "${tagname}: ${taguri}"
- fi
-
+ ;;
+ "${botname}, are "*)
case "${text}" in
- *\#nospoil*)
- ;;
- *\#tag[^a-zA-Z-]*)
- randomtag=1
- ;;
- *\#tag)
- randomtag=1
- ;;
- *rfc[0-9]*)
- rfcname="$(printf "%s\n" "${text}" | sed 's,.*\(rfc[0-…
- annna-say -c "#bitreich-en" "${rfcname}: ftp://ftp.rfc…
- ;;
- *RFC[0-9]*)
- rfcname="$(printf "%s\n" "${text}" | sed 's,.*\(RFC[0-…
- annna-say -c "#bitreich-en" "${rfcname}: ftp://ftp.rfc…
+ *" in love?")
+ words="$(printf "%s\n" "${text}" | sed 's,.*are \(.*\)…
+ lovedistance="$(printf "%s * 100\n" "$(fstrcmp ${words…
+ if [ $lovedistance -gt 15 ];
+ then
+ annna-say -c "${channel}" 'Yes!!! Pure <3 <3'
+ else
+ annna-say -c "${channel}" "No."
+ fi
;;
esac
-
- if [ $randomtag -gt 0 ];
- then
- while [ $randomtag -gt 0 ];
- do
- rtag="$(printf "%s\n" "$(hashtags)" | shuf -n …
- tagname=""
- taguri=""
- for tag in ${rtag};
- do
- [ -z "${tagname}" ] && tagname="${tag}…
- taguri="${tag}"
- done
-
- annna-say -c "#bitreich-en" "${tagname}: ${tag…
-
- randomtag=$(($randomtag - 1))
- done
- else
+ ;;
+ esac
+
+ case "${text}" in
+ "${botname}, please turn on "*)
+ word="$(printf "%s\n" "${text}" | cut -c 22-)"
+ annna-say -c "${channel}" "☞ ⏻ ${word}"
+ ;;
+ "${botname}, please turn me on.")
+ annna-say -c "${channel}" "☞ ⏻ ${user}"
+ ;;
+ esac
+
+ if [ "${text}" = "${botname}, I'm bored." ];
+ then
+ randomlink="$(/br/bin/bitreich-lawn-random-link)"
+ linktype="$(printf "%s\n" "${randomlink}" | cut -d '|' -f1 | c…
+ linktext="$(printf "%s\n" "${randomlink}" | cut -d '|' -f2)"
+ linksel="$(printf "%s\n" "${randomlink}" | cut -d '|' -f3)"
+ linkserver="$(printf "%s\n" "${randomlink}" | cut -d '|' -f4)"
+ linkport="$(printf "%s\n" "${randomlink}" | cut -d '|' -f5 | c…
+ outtext="$(printf "%s - gopher://%s" "$linktext" "$linkserver"…
+ if [ "$linkport" != "70" -a "$linkport" != "port" ];
+ then
+ outtext="$(printf "%s:%s" "$outtext" "$linkport")"
+ fi
+ if [ -n "$linksel" ];
+ then
+ outtext="$(printf "%s/%s%s" "$outtext" "$linktype" "$l…
+ fi
+ annna-say -c "${channel}" "$outtext"
+ fi
+
+ if [ "${text}" = "${botname}, what's up?" ];
+ then
+ newsstr="$(ecl -shell /home/solene/gopher/bin/generator.lisp)"
+ annna-say -c "${channel}" "$newsstr"
+ return
+ fi
+
+ if [ "${text}" = "${botname}, I feel sick." ];
+ then
+ newsstr="$(cd /br/gopher/hypochondria && ./hypochondria -s ran…
+ annna-say -c "${channel}" "You could have ${newsstr}! Be caref…
+ return
+ fi
+
+ if [ "${text}" = "${botname}, oh hai!" ];
+ then
+ annna-say -c "${channel}" "${user}, hai! How is your sex life?"
+ return
+ fi
+
+ if [ "${text}" = "${botname}, please tech hype me." ];
+ then
+ techstr="$(${modbase}/markov_tech/markov)"
+ annna-say -c "${channel}" "${techstr}"
+ return
+ fi
+
+ if [ "${text}" = "${botname}, what's my horoscope?" ];
+ then
+ horostr="$($HOME/scm/bullshit/horoscope)"
+ annna-say -c "${channel}" "${user}, ${horostr}"
+ return
+ fi
+
+ if [ "${text}" = "${botname}, what's my future?" ];
+ then
+ purl="$(sacc gopher://parazyd.org/0/tarot.cgi | /br/bin/bitrei…
+ annna-say -c "${channel}" "${user}, your future is here: ${pur…
+ return
+ fi
+
+ randomtag=0
+ if [ "${text}" = "${botname}, please meme meme meme me." ];
+ then
+ randomtag=2
+ fi
+
+ if [ "${text}" = "${botname}, what's the wheelchair shooter meme again…
+ then
+ tagname="#scrollby"
+ tagline="$(printf "%s\n" "$(hashtags)" | grep "^${tagname} ")"
+ tagname="$(printf "%s\n" "${tagline}" | cut -d ' ' -f 1)"
+ taguri="$(printf "%s\n" "${tagline}" | cut -d ' ' -f 2-)"
+ annna-say -c "${channel}" "${tagname}: ${taguri}"
+ fi
+
+ case "${text}" in
+ *\#nospoil*)
+ ;;
+ *\#tag[^a-zA-Z-]*)
+ randomtag=1
+ ;;
+ *\#tag)
+ randomtag=1
+ ;;
+ *rfc[0-9]*)
+ rfcname="$(printf "%s\n" "${text}" | sed 's,.*\(rfc[0-9]*\).*,…
+ annna-say -c "${channel}" "${rfcname}: ftp://ftp.rfc-editor.or…
+ ;;
+ *RFC[0-9]*)
+ rfcname="$(printf "%s\n" "${text}" | sed 's,.*\(RFC[0-9]*\).*,…
+ annna-say -c "${channel}" "${rfcname}: ftp://ftp.rfc-editor.or…
+ ;;
+ esac
+
+ if [ $randomtag -gt 0 ];
+ then
+ while [ $randomtag -gt 0 ];
+ do
+ rtag="$(printf "%s\n" "$(hashtags)" | shuf -n 1)"
tagname=""
taguri=""
- for tag in $(hashtags);
+ for tag in ${rtag};
do
[ -z "${tagname}" ] && tagname="${tag}" && con…
taguri="${tag}"
-
- case "${text}" in
- *\#nospoil*)
- break;
- ;;
- *${tagname}[^a-zA-Z-]*)
- annna-say -c "#bitreich-en" "${tagname…
- break;
- ;;
- *${tagname})
- annna-say -c "#bitreich-en" "${tagname…
- break;
- ;;
- esac
- tagname=""
done
- fi
-
- if [ "${text}" = "${botname}, how many memes do you know?" ];
- then
- annna-say -c "#bitreich-en" "I know $(hashtagcount) me…
- continue;
- fi
-
- if [ "${text}" = "${botname}, how many people died of corona?"…
- then
- annna-say -c "#bitreich-en" "${user}, too many. :( Ple…
- continue;
- fi
-
-
- if [ "${text}" = "${botname}, please show me your memes." ];
- then
- purl="$(printf "%s" "$(hashtags)" | /br/bin/bitreich-p…
- annna-say -c "#bitreich-en" "Here are my memes: ${purl…
- continue;
- fi
- if [ "${text}" = "${botname}, please distro-hop with me." ];
- then
- ndistro="$(curl -s 'https://distrowatch.com/dwres.php?…
- | grep phr2 \
- | sed 's,.*href="\(.*\)".*,\1,' \
- | sort | uniq | shuf -n 1)"
- annna-say -c "#bitreich-en" "How about https://distrow…
- continue;
- fi
+ annna-say -c "${channel}" "${tagname}: ${taguri}"
- ismember=0
- for member in $brmembers;
- do
- [ "$user" = "$member" ] && ismember=1
+ randomtag=$(($randomtag - 1))
done
- [ $ismember -lt 1 ] && continue
-
- if [ "${text}" = "${botname}, be cool." ];
- then
- case "$(($RANDOM % 4))" in
- 0)
- annna-say -c "#bitreich-en" "(⌐■_■)"
- ;;
- 1)
- annna-say -c "#bitreich-en" "(▰˘◡˘▰)"
- ;;
- 2)
- annna-say -c "#bitreich-en" "(▀ Ĺ▀ )̄"
- ;;
- *)
- annna-say -c "#bitreich-en" "(▀Ĺ▀ )"
- ;;
- esac
- continue;
- fi
-
- if [ "${text}" = "${botname}, please cheer." ];
- then
- case "$(($RANDOM % 2))" in
- 0)
- annna-say -c "#bitreich-en" '~\o/~'
- ;;
- *)
- annna-say -c "#bitreich-en" '✺◟( ° ʖ °)…
- ;;
- esac
- continue;
- fi
+ else
+ tagname=""
+ taguri=""
+ for tag in $(hashtags);
+ do
+ [ -z "${tagname}" ] && tagname="${tag}" && continue
+ taguri="${tag}"
- if [ "${text}" = "${botname}, be cute." ];
- then
- case "$(($RANDOM % 4))" in
- 0)
- annna-say -c "#bitreich-en" ' (\ /)'
- sleep 0.1
- annna-say -c "#bitreich-en" ' (. .)'
- sleep 0.1
- annna-say -c "#bitreich-en" ' C(") (")'
- ;;
- 1)
- annna-say -c "#bitreich-en" ' (\-/)'
- sleep 0.1
- annna-say -c "#bitreich-en" " (='.'=)"
- sleep 0.1
- annna-say -c "#bitreich-en" ' (")-(")o'
+ case "${text}" in
+ *\#nospoil*)
+ break;
;;
- 2)
- annna-say -c "#bitreich-en" ' ( ) ( )'
- sleep 0.1
- annna-say -c "#bitreich-en" ' (>•.•<)'
- sleep 0.1
- annna-say -c "#bitreich-en" ' (") (")'
+ *${tagname}[^a-zA-Z-]*)
+ annna-say -c "${channel}" "${tagname}: ${tagur…
+ break;
;;
- *)
- annna-say -c "#bitreich-en" ' (\ (\'
- sleep 0.1
- annna-say -c "#bitreich-en" " (=' :')"
- sleep 0.1
- annna-say -c "#bitreich-en" ' (, (") (")'
+ *${tagname})
+ annna-say -c "${channel}" "${tagname}: ${tagur…
+ break;
;;
esac
- continue;
- fi
-
- if [ "${text}" = "${botname}, can you show me the uptime pleas…
- then
- annna-say -c "#bitreich-en" "$(hostname) uptime: $(upt…
- continue;
- fi
-
- if [ "${text}" = "${botname}, please show me the load." ];
- then
- annna-say -c "#bitreich-en" "$(hostname) load: $(LANG=…
- continue;
- fi
-
- if [ "${text}" = "${botname}, please show me your Macron." ];
- then
- annna-say -c "#bitreich-en" "gopher://bitreich.org/0/a…
- continue;
- fi
-
- if [ "${text}" = "${botname}, please give me the count of onli…
- then
- annna-say -c "#bitreich-en" "$(hostname): $(who -q | t…
- continue;
- fi
+ tagname=""
+ done
+ fi
+
+ if [ "${text}" = "${botname}, how many memes do you know?" ];
+ then
+ annna-say -c "${channel}" "I know $(hashtagcount) memes: gophe…
+ return
+ fi
+
+ if [ "${text}" = "${botname}, how many people died of corona?" ];
+ then
+ annna-say -c "${channel}" "${user}, too many. :( Please see yo…
+ return
+ fi
+
+
+ if [ "${text}" = "${botname}, please show me your memes." ];
+ then
+ purl="$(printf "%s" "$(hashtags)" | /br/bin/bitreich-paste)"
+ annna-say -c "${channel}" "Here are my memes: ${purl}"
+ return
+ fi
+
+ if [ "${text}" = "${botname}, please distro-hop with me." ];
+ then
+ ndistro="$(curl -s 'https://distrowatch.com/dwres.php?resource…
+ | grep phr2 \
+ | sed 's,.*href="\(.*\)".*,\1,' \
+ | sort | uniq | shuf -n 1)"
+ annna-say -c "${channel}" "How about https://distrowatch.com/$…
+ return
+ fi
+
+ ismember=0
+ for member in $brmembers;
+ do
+ [ "$user" = "$member" ] && ismember=1
+ done
+ [ $ismember -lt 1 ] && return
- if [ "${text}" = "${botname}, please roll a dice for me." ];
- then
- annna-say -c "#bitreich-en" "$((($RANDOM % 6) + 1))"
- continue;
+ if [ "${text}" = "${botname}, be cool." ];
+ then
+ case "$(($RANDOM % 4))" in
+ 0)
+ annna-say -c "${channel}" "(⌐■_■)"
+ ;;
+ 1)
+ annna-say -c "${channel}" "(▰˘◡˘▰)"
+ ;;
+ 2)
+ annna-say -c "${channel}" "(▀ Ĺ▀ )̄"
+ ;;
+ *)
+ annna-say -c "${channel}" "(▀Ĺ▀ )"
+ ;;
+ esac
+ return
+ fi
+
+ if [ "${text}" = "${botname}, please cheer." ];
+ then
+ case "$(($RANDOM % 2))" in
+ 0)
+ annna-say -c "${channel}" '~\o/~'
+ ;;
+ *)
+ annna-say -c "${channel}" '✺◟( ° ʖ °)◞✺'
+ ;;
+ esac
+ return
+ fi
+
+ if [ "${text}" = "${botname}, be cute." ];
+ then
+ case "$(($RANDOM % 4))" in
+ 0)
+ annna-say -c "${channel}" ' (\ /)'
+ sleep 0.1
+ annna-say -c "${channel}" ' (. .)'
+ sleep 0.1
+ annna-say -c "${channel}" ' C(") (")'
+ ;;
+ 1)
+ annna-say -c "${channel}" ' (\-/)'
+ sleep 0.1
+ annna-say -c "${channel}" " (='.'=)"
+ sleep 0.1
+ annna-say -c "${channel}" ' (")-(")o'
+ ;;
+ 2)
+ annna-say -c "${channel}" ' ( ) ( )'
+ sleep 0.1
+ annna-say -c "${channel}" ' (>•.•<)'
+ sleep 0.1
+ annna-say -c "${channel}" ' (") (")'
+ ;;
+ *)
+ annna-say -c "${channel}" ' (\ (\'
+ sleep 0.1
+ annna-say -c "${channel}" " (=' :')"
+ sleep 0.1
+ annna-say -c "${channel}" ' (, (") (")'
+ ;;
+ esac
+ return
+ fi
+
+ if [ "${text}" = "${botname}, can you show me the uptime please?" ];
+ then
+ annna-say -c "${channel}" "$(hostname) uptime: $(uptime)"
+ return
+ fi
+
+ if [ "${text}" = "${botname}, please show me the load." ];
+ then
+ annna-say -c "${channel}" "$(hostname) load: $(LANG=C uptime |…
+ return
+ fi
+
+ if [ "${text}" = "${botname}, please show me your Macron." ];
+ then
+ annna-say -c "${channel}" "gopher://bitreich.org/0/ascii/macro…
+ return
+ fi
+
+ if [ "${text}" = "${botname}, please give me the count of online users…
+ then
+ annna-say -c "${channel}" "$(hostname): $(who -q | tail -n 1 |…
+ return
+ fi
+
+ if [ "${text}" = "${botname}, please roll a dice for me." ];
+ then
+ annna-say -c "${channel}" "$((($RANDOM % 6) + 1))"
+ return
+ fi
+
+ if [ "${text}" = "${botname}, please tell me your favourite flower." ];
+ then
+ annna-say -c "${channel}" "My favourite flower is the beer flo…
+ return
+ fi
+
+ if [ "${text}" = "${botname}, please tell me your favourite color." ];
+ then
+ annna-say -c "${channel}" "My favourite color is yellow."
+ return
+ fi
+
+ if [ "${text}" = "${botname}, please dance." ];
+ then
+ if [ $(($RANDOM % 2)) -gt 0 ];
+ then
+ annna-say -c "${channel}" ',o/ o/_ _\o _o_ \o\'
+ else
+ annna-say -c "${channel}" '\o7 -o7 _o7 .o7 \o. \o_ \o-…
fi
+ return
+ fi
- if [ "${text}" = "${botname}, please tell me your favourite fl…
+ if [ "${text}" = "${botname}, please dance with me." ];
+ then
+ if [ $(($RANDOM % 2)) -gt 0 ];
then
- annna-say -c "#bitreich-en" "My favourite flower is th…
- continue;
- fi
+ annna-say -c "${channel}" "I am not that kind of woman…
+ else
+ annna-say -c "${channel}" "Thank you! Let us dance! :-…
+ fi
+ return
+ fi
+
+ if [ "${text}" = "${botname}, please tell me who is your favourite ple…
+ then
+ annna-say -c "${channel}" "My favourite pleasure man is of cou…
+ return
+ fi
+
+ if [ "${text}" = "${botname}, sudo make me a sandwich" ];
+ then
+ annna-say -c "${channel}" "Humans are no objects."
+ return
+ fi
+
+ if [ "${text}" = "${botname}, sudo please make me a sandwich" ];
+ then
+ annna-say -c "${channel}" "Here is your sandwich."
+ return
+ fi
+
+ if [ "${text}" = "${botname}, please update the phlog index." ];
+ then
+ phlog-index > /dev/null 2>&1
+ annna-say -c "${channel}" "Thanks! Your request has been fulfi…
+ return
+ fi
+
+ if [ "${text}" = "${botname}, bonjour !" ];
+ then
+ annna-say -c "${channel}" "${user}, bonjour !"
+ return
+ fi
+
+ if [ "${text}" = "${botname}, please help." ];
+ then
+ # TODO: Add multiple line support to annna-say -c(1) with slee…
+ annna-say -c "${user}" "»how many memes do you know?«gets yo…
+ sleep 0.5
+ annna-say -c "${user}" "»please show me your memes.« gets yo…
+ sleep 0.5
+ annna-say -c "${user}" "»can you show me the uptime please?«…
+ sleep 0.5
+ annna-say -c "${user}" "»please show me the load, ${user}."
+ sleep 0.5
+ annna-say -c "${user}" "»please give me the count of online u…
+ sleep 0.5
+ annna-say -c "${user}" "»please tell me your favourite flower…
+ sleep 0.5
+ annna-say -c "${user}" "»please tell me your favourite color.…
+ sleep 0.5
+ annna-say -c "${user}" "»please dance with me.«, ${user}."
+ sleep 0.5
+ annna-say -c "${user}" "»please distro-hop with me.«, ${user…
+ sleep 0.5
+ annna-say -c "${user}" "»please dance.«, ${user}."
+ sleep 0.5
+ annna-say -c "${user}" "»what's up?«, ${user}."
+ sleep 0.5
+ annna-say -c "${user}" "»please update the phlog index.«, ${…
+ sleep 0.5
+ annna-say -c "${user}" "»sudo make me a sandwich«, ${user}."
+ sleep 0.5
+ annna-say -c "${user}" "»sudo please make me a sandwich«, ${…
+ sleep 0.5
+ annna-say -c "${user}" "»please tell me who is your favourite…
+ sleep 0.5
+ annna-say -c "${user}" "»please roll a dice for me.«, ${user…
+ sleep 0.5
+ annna-say -c "${user}" "»I'm bored.«, ${user}."
+ sleep 0.5
+ annna-say -c "${user}" "», be cool.«, ${user}."
+ sleep 0.5
+ annna-say -c "${user}" "», be cute.«, ${user}."
+ sleep 0.5
+ annna-say -c "${user}" "», what is \$term?«, ${user}."
+ sleep 0.5
+ annna-say -c "${user}" "», please turn on \$term«, ${user}."
+ sleep 0.5
+ annna-say -c "${user}" "», turn me on."
+ sleep 0.5
+ annna-say -c "${user}" "», please tech hype me."
+ sleep 0.5
+ annna-say -c "${user}" "», bonjour !"
+ sleep 0.5
+ annna-say -c "${user}" "»please help.« gives you this help l…
+ return
+ fi
+}
- if [ "${text}" = "${botname}, please tell me your favourite co…
- then
- annna-say -c "#bitreich-en" "My favourite color is yel…
- continue;
- fi
+# Permissions
+[ -d ${iiroot} ] && chmod o+rx ${iiroot}
+[ -d ${iibase} ] && chmod o+rx ${iibase}
- if [ "${text}" = "${botname}, please dance." ];
- then
- if [ $(($RANDOM % 2)) -gt 0 ];
- then
- annna-say -c "#bitreich-en" ',o/ o/_ _\o _…
- else
- annna-say -c "#bitreich-en" '\o7 -o7 _o7 .o7 \…
- fi
- continue;
- fi
+# All channels only requiring annna_common.
+common_channels="#bitreich-en #bitreich-fr #bitreich-de #bitreich-nl #bitreich…
+for chan in $common_channels;
+do
+ [ -d "${iibase}/${chan}" ] \
+ && chmod o+rx "${iibase}/${chan}"
+ [ -p "${iibase}/${chan}/in" ] \
+ && chmod o+w "${iibase}/${chan}/in"
+done
+
+# Channels with extra features or external scripts.
+## SCM (/scm/post-receive)
+## This one is handled by common_channels.
- if [ "${text}" = "${botname}, please dance with me." ];
- then
- if [ $(($RANDOM % 2)) -gt 0 ];
- then
- annna-say -c "#bitreich-en" "I am not that kin…
- else
- annna-say -c "#bitreich-en" "Thank you! Let us…
- fi
-
- continue;
- fi
+## Radio (/br/radio/playlist.sh + this script)
+[ -d "${iibase}/#bitreich-radio" ] \
+ && chmod o+rx "${iibase}/#bitreich-radio"
+[ -p "${iibase}/#bitreich-radio/in" ] \
+ && chmod o+w "${iibase}/#bitreich-radio/in"
- if [ "${text}" = "${botname}, please tell me who is your favou…
- then
- annna-say -c "#bitreich-en" "My favourite pleasure man…
- continue;
- fi
- if [ "${text}" = "${botname}, sudo make me a sandwich" ];
- then
- annna-say -c "#bitreich-en" "Humans are no objects."
- continue;
- fi
+# Channel handlers.
- if [ "${text}" = "${botname}, sudo please make me a sandwich" …
- then
- annna-say -c "#bitreich-en" "Here is your sandwich."
- continue;
- fi
+## Special handlers first.
+if [ -f "${iibase}/#bitreich-radio/out" ];
+then
+{
+ channel="#bitreich-radio"
+ ls "${iibase}/${channel}/out" | entr tail -n 1 "${iibase}/${channel}/o…
+ | grep -v --line-buffered '[0-9]* -!- ' \
+ | sed -u 's,[0-9]* <\([^ >]*\)> \(.*\),\1\n\2,' \
+ | {
+ while read -r user;
+ do
+ read -r text
- if [ "${text}" = "${botname}, please update the phlog index." …
- then
- phlog-index > /dev/null 2>&1
- annna-say -c "#bitreich-en" "Thanks! Your request has …
- continue;
- fi
+ [ "$user" = "${botname}" ] && continue
- if [ "${text}" = "${botname}, bonjour !" ];
+ if [ "${text}" = "${botname}, next please." ];
then
- annna-say -c "#bitreich-en" "${user}, bonjour !"
+ /br/bin/bitreich-radio-playlist-next
+ annna-say -c "${channel}" "You are very kind ${user}. …
continue;
fi
if [ "${text}" = "${botname}, please help." ];
then
- # TODO: Add multiple line support to annna-say -c(1) w…
- annna-say -c "${user}" "»how many memes do you know?�…
- sleep 0.5
- annna-say -c "${user}" "»please show me your memes.«…
- sleep 0.5
- annna-say -c "${user}" "»can you show me the uptime p…
- sleep 0.5
- annna-say -c "${user}" "»please show me the load, ${u…
- sleep 0.5
- annna-say -c "${user}" "»please give me the count of …
- sleep 0.5
- annna-say -c "${user}" "»please tell me your favourit…
- sleep 0.5
- annna-say -c "${user}" "»please tell me your favourit…
- sleep 0.5
- annna-say -c "${user}" "»please dance with me.«, ${u…
- sleep 0.5
- annna-say -c "${user}" "»please distro-hop with me.«…
- sleep 0.5
- annna-say -c "${user}" "»please dance.«, ${user}."
- sleep 0.5
- annna-say -c "${user}" "»what's up?«, ${user}."
- sleep 0.5
- annna-say -c "${user}" "»please update the phlog inde…
- sleep 0.5
- annna-say -c "${user}" "»sudo make me a sandwich«, $…
- sleep 0.5
- annna-say -c "${user}" "»sudo please make me a sandwi…
- sleep 0.5
- annna-say -c "${user}" "»please tell me who is your f…
- sleep 0.5
- annna-say -c "${user}" "»please roll a dice for me.«…
- sleep 0.5
- annna-say -c "${user}" "»I'm bored.«, ${user}."
- sleep 0.5
- annna-say -c "${user}" "», be cool.«, ${user}."
- sleep 0.5
- annna-say -c "${user}" "», be cute.«, ${user}."
- sleep 0.5
- annna-say -c "${user}" "», what is \$term?«, ${user}…
- sleep 0.5
- annna-say -c "${user}" "», please turn on \$term«, $…
- sleep 0.5
- annna-say -c "${user}" "», turn me on."
- sleep 0.5
- annna-say -c "${user}" "», please tech hype me."
- sleep 0.5
- annna-say -c "${user}" "», bonjour !"
- sleep 0.5
+ annna-say -c "${user}" "»next please.« gets the play…
annna-say -c "${user}" "»please help.« gives you thi…
+
+ # Give out common help too.
+ annna_common "${channel}" "${user}" "${text}"
continue;
fi
+
+ # Allow common functions too.
+ annna_common "${channel}" "${user}" "${text}"
done
}
} &
fi
+## Common channel handler.
+for channel in $common_channels;
+do
+ if [ -f "${iibase}/${channel}/out" ];
+ then
+ {
+ ls "${iibase}/${channel}/out" | entr tail -n 1 "${iibase}/${ch…
+ | grep -v --line-buffered '[0-9]* -!- ' \
+ | sed -u 's,[0-9]* <\([^ >]*\)> \(.*\),\1\n\2,' \
+ | {
+ while read -r user;
+ do
+ read -r text
+
+ annna_common "${channel}" "${user}" "${text}"
+ done
+ }
+ } &
+ fi
+done
+
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.