URI: 
       annna-message-common - annna - Annna the nice friendly bot.
  HTML git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/annna/
   DIR Log
   DIR Files
   DIR Refs
   DIR Tags
   DIR README
       ---
       annna-message-common (66102B)
       ---
            1 #!/bin/bash
            2 
            3 export PATH="/br/bin:$PATH"
            4 
            5 cfgbase="$(pwd)"
            6 ircbase="$(cat ${cfgbase}/ircbase)"
            7 modbase="$(cat ${cfgbase}/modbase)"
            8 hashtagfile="${modbase}/hashtags/hashtags.txt"
            9 idontcaredb="${modbase}/i-dont-care/i-dont-care.txt"
           10 printnhashtags=2
           11 brmembers="__20h__ Evil_Bob chripo posativ quinq stateless solene josuah parazyd bin KatolaZ adc Athas ROYGBYTE"
           12 referees="__20h__"
           13 ignorednicks="eidolon"
           14 linkbrotherchannels="#bitreich-meme"
           15 
           16 server="$1"
           17 ircuser="$(cat ${cfgbase}/${server}/ircuser)"
           18 channel="$2"
           19 user="$3"
           20 text="$4"
           21 cmd="$5"
           22 annnasumerian="𒈹"
           23 annnabirthday="1989-05-18"
           24 
           25 hashtags() {
           26         cat ${hashtagfile} 2>/dev/null
           27 }
           28 
           29 hashtagcount() {
           30         int2bit "$(curl -s gophers://bitreich.org/1/meme/count \
           31                 | grep total \
           32                 | head -n 1 \
           33                 | sed 's,.*total on .*: \([0-9]*\)),\1,')"
           34 }
           35 
           36 regeximatch() {
           37         printf '%s' "$1" | grep -i -E -q "$2"
           38 }
           39 
           40 #printf "%s %s %s %s\n" "${0##*/}" "${channel}" "${user}" "${text}"
           41 
           42 [ "$user" = "${ircuser}" ] && exit 0
           43 
           44 isignored=0
           45 for ignorednick in $ignorednicks;
           46 do
           47         [ "$user" = "$ignorednick" ] && isignored=1
           48 done
           49 [ $isignored -eq 1 ] && exit
           50 
           51 # Flag, if some expansion of some URI happened.
           52 uriexpansion=0
           53 # Do not spoil at all.
           54 nospoil=0
           55 # Enforce spoiling in case of hard nospoil filter.
           56 dospoil=0
           57 # Expand meme hashtag and show recommendations.
           58 doexpand=0
           59 
           60 [ -z "${text}" ] && exit 0
           61 case "${text}" in
           62 *\#nospoil*)
           63         nospoil=1
           64         ;;
           65 *\#expand*)
           66         doexpand=1
           67         ;;
           68 *::*::*)
           69         if [ $(pgrep -f stable-diffusion-emoji 2>/dev/null | wc -l) -gt 3 ];
           70         then
           71                 annna-say -s "${server}" -c "${channel}" "${user}, sorry, gophers://bitreich.org/I/memecache/bitreich-burning.png"
           72         else
           73                 {
           74                         query=${text#**::} query=${query%%::*}
           75                         emojiuri="$(stable-diffusion-emoji "${query}")"
           76                         if [ -n "${emojiuri}" ];
           77                         then
           78                                 if [ -n "${user}" ] && [ "${user}" != "annna-cmd" ];
           79                                 then
           80                                         annna-say -s "${server}" -c "${channel}" "${user}, ${emojiuri}"
           81                                 else
           82                                         annna-say -s "${server}" -c "${channel}" "${emojiuri}"
           83                                 fi
           84                         fi
           85                 } &
           86         fi
           87         ;;
           88 *http*://*|*ytdl://*)
           89         case "${text}" in
           90         *"#spoil"*)
           91                 dospoil=1
           92                 ;;
           93         esac
           94 
           95         case "${text}" in
           96         *http*://*)
           97                 uri="$(printf "%s\n" "${text}" \
           98                         | sed -n '/.*\(https\{0,1\}:\/\/[^ ]\{1,\}\).*/s//\1/p')"
           99                 ;;
          100         *ytdl://*)
          101                 ytid="$(printf "%s\n" "${text}" \
          102                         | sed -n '/.*ytdl:\/\/\([^ ]\{1,\}\).*/s//\1/p')"
          103                 uri="$(printf "https://www.youtube.com/watch?v=%s" "${ytid}")"
          104                 ;;
          105         esac
          106 
          107         # Set below and annna will concatenate at the end.
          108         # HTML title.
          109         urititle=""
          110         # Subtitle URI.
          111         sturi=""
          112         # Replacement URI.
          113         nuri=""
          114         # Replacement URI display string.
          115         nuris=""
          116         # html2text content.
          117         curi=""
          118         # Set to 0, if some URI content should be shown.
          119         nocuri=1
          120         # Screenshot.
          121         suri=""
          122 
          123         # titleend=1 will not output any further.
          124         titleend=0
          125         outputstr=""
          126 
          127         if is-invidious-instance "${uri}";
          128         then
          129                 host="$(printf "%s\n" "${uri}" \
          130                         | sed 's,.*://\([^/]*\).*,\1,')"
          131                 if [ -n "${host}" ];
          132                 then
          133                         uri="$(printf "%s\n" "${uri}" \
          134                                 | sed "s,${host},youtube.com,")"
          135                 fi
          136         fi
          137 
          138         tmpf=$(mktemp)
          139         fetch-uri "${uri}" > "${tmpf}"
          140         if [ ! -s "${tmpf}" ];
          141         then
          142                 archiveorguri="$(archiveorg-uri "${uri}")"
          143                 if [ -n "${archiveorguri}" ];
          144                 then
          145                         sarchiveorguri="$(bitreich-uri-shortener "${archiveorguri}")"
          146                         nuris="archive: ${sarchiveorguri}"
          147                         fetch-uri "${archiveorguri}" > "${tmpf}"
          148                 fi
          149         fi
          150         [ -s "${tmpf}" ] && urititle="$(grabtitle < "${tmpf}")"
          151 
          152         case "${urititle}" in
          153         "")
          154                 ;;
          155         *Gunther*|*GUNTHER*|*Günther*|*GÜNTHER*)
          156                 annna-say -s "${server}" -c "${channel}" "Oh Günther! ❤  ❤  ❤  ${urititle}"
          157                 uriexpansion=1
          158                 ;;
          159         *\|\ Cloudflare*|"Just a moment...")
          160                 annna-say -s "${server}" -c "${channel}" "Mind your own business! We got clownflared: gophers://bitreich.org/0/ascii/clownflare.vt"
          161                 titleend=1
          162                 uriexpansion=1
          163                 ;;
          164         esac
          165 
          166         case "${uri}" in
          167         "")
          168                 ;;
          169         *github.com/*/blob/*)
          170                 urltitle=""
          171                 nuris="$(printf '%s' "${uri}" | sed 's/blob/raw/')"
          172                 nocuri=0
          173                 ;;
          174         *imgur.com/*)
          175                 nuris="$(youtube-dl -g "${uri}")" || nuris=""
          176                 ;;
          177         *xkcd.com/*)
          178                 nuris="$(xkcd-uri "${uri}")"
          179                 ;;
          180         *imdb.com/title/*)
          181                 imdbstr="$(imdb2gopherbay "${uri}")"
          182                 if [ -n "${imdbstr}" ];
          183                 then
          184                         nuris="${imdbstr}"
          185                         urititle=""
          186                 fi
          187                 ;;
          188         # bay.parazy.de is unmaintained
          189         #*themoviedb.org/movie/*)
          190         #        movietitle="$(themoviedb2gopherbay "${uri}" | sed 's, ,+,g')"
          191         #        if [ -n "${movietitle}" ];
          192         #        then
          193         #                nuris="gophers://bay.parazy.de:666/1/q.dcgi?${movietitle}"
          194         #        fi
          195         #        ;;
          196         *lichess.org/????????|*lichess.org/????????/|*lichess.org/????????/black|*lichess.org/????????/white)
          197                 nuris="$(printf "%s\n" "${uri}" \
          198                         | sed 's,https://lichess.org\(/[^ ]*\)$,\1,; s,^/\([^/]*\)/black$,/black/\1,; s,/white,,; s,\(.*\),https://lichess1.org/game/export/gif\1.gif,;')"
          199                 ;;
          200         *npr.org/*)
          201                 post="$(printf '%s\n' "${uri}" | sed -n 's@.*/\([0-9]\{10\}\)/.*$@\1@p')"
          202                 if [ -n "${post}" ];
          203                 then
          204                         nuri="https://text.npr.org/${post}"
          205                         nuris="text only: ${nuri}"
          206                 fi
          207                 ;;
          208         *csdb.dk/release/*)
          209                 sid=$(awk '/<a href="download\.php.*\.sid/ { match($0, /https:\/\/.*\.sid</); print substr($0, RSTART, RLENGTH-1); exit }' "$tmpf")
          210                 [ -n "$sid" ] && nuris="listen: $sid"
          211                 ;;
          212         *www.forgottenweapons.com/*)
          213                 ytid=$(sed -n '/<meta name="description"/ s/.*https:\/\/youtu\.be\/\([-A-Za-z0-9_]\{11\}\).*/\1/p' "$tmpf")
          214                 if [ -n "$ytid" ]; then
          215                         nuris="video: ytdl://$ytid ;"
          216                         nuris="$nuris metadata: gophers://codemadness.org/1/idiotbox.cgi?v=$ytid"
          217                 fi
          218                 ;;
          219         *www.reddit.com*)
          220                 nuri="$(printf '%s\n' "${uri}" | sed "s;www.reddit.com;old.reddit.com;")"
          221                 nuris="old.reddit: ${nuri}"
          222                 fetch-uri "${nuri}" > "${tmpf}"
          223                 if [ -n "${uri#*www.reddit.com/r/*}" ];
          224                 then
          225                         subreddit="$(printf '%s\n' "${uri}" | cut -d / -f 5)"
          226                         post="$(printf '%s\n' "${uri}" | cut -d / -f 7)"
          227                         if [ -n "${post}" ];
          228                         then
          229                                 guri="gopher://gopherddit.com/1/cgi-bin/reddit.cgi?view&${post}&${subreddit}&10"
          230                         else
          231                                 guri="gopher://gopherddit.com/1/cgi-bin/reddit.cgi?menu&${subreddit}&10"
          232                         fi
          233                         nuris="${nuri} ; gopherdit: ${guri}"
          234                 fi
          235                 nocuri=0
          236                 ;;
          237         *taz.de*)
          238                 newsid="$(printf '%s\n' "${uri}" | sed 's,.*\(![0-9]*\).*,\1,')"
          239                 if [ -n "${newsid}" ];
          240                 then
          241                         urititle="$(curl-grabtitle "${uri}")"
          242                         nuris="gopher://taz.de/1/${newsid}"
          243                         nocuri=1
          244                 fi
          245                 ;;
          246         *x.com/*/status/*)
          247                 tid="$(printf "%s\n" "${uri}" | sed 's,.*status/\([0-9]*\)$,\1,')"
          248                 if [ -n "${tid}" ];
          249                 then
          250                         nuris="https://twitter-thread.com/pdf/${tid}"
          251                         nocuri=1
          252                 fi
          253                 ;;
          254         *twitter.com*)
          255                 #ninstance="$(nitter-instance | sed 's,\.,\\\.,g')"
          256                 #nuri="$(printf "%s\n" "${uri}" | sed "s;\(mobile\.\)\{0,1\}twitter\.com;${ninstance};")"
          257                 fetch-uri "${uri}" > "${tmpf}"
          258                 urititle="$(curl-grabtitle "${uri}")"
          259                 #suri="$(screenshot-paste "${uri}")"
          260                 #nuris="nitter: ${nuri}"
          261                 nocuri=0
          262                 ;;
          263         *.wikipedia.org/wiki/*)
          264                 if ! regeximatch "$uri" '\.(jpg,bmp,gif,png,tiff,avi,mp4,webm,mkv,pdf,ps,eps)$';
          265                 then
          266                         nuri="$(printf '%s\n' "${uri}" | sed -Ee "s;/wiki/;/api/rest_v1/page/pdf/;" -e "s;(\?|#).*$;;")"
          267                         nuris="$(printf 'pdf: %s\n' "${nuri}")"
          268                         nocuri=1
          269                 fi
          270                 ;;
          271         *youtube.com/*|*youtu.be/*)
          272                 # Youtube is so annoying and repeatedly broken;
          273                 # they hate users, only expand on request.
          274                 if [ $dospoil -eq 1 ];
          275                 then
          276                         if [ -z "${uri##*youtu.be/*}" ] \
          277                                 || [ -z "${uri##*/watch?v=*}" ] \
          278                                 || [ -z "${uri##*/embed/*}" ] \
          279                                 || [ -z "${uri##*/shorts/*}" ];
          280                         then
          281                                 ytid="${uri#http*://*/watch?v=}"
          282                                 ytid="${ytid##*embed/}"
          283                                 ytid="${ytid##*shorts/}"
          284                                 ytid="${ytid##*youtu.be/}"
          285                                 ytid="${ytid%%\?*}"
          286                                 ytid="${ytid%%&*}"
          287                                 nuri="$(get-invidious-instance)/watch?v=${ytid}"
          288                                 ytt="$(printf '%s\n' "${uri}" | sed -n 's/.*[&?]t=\([^&]\{1,\}\).*/\1/p')"
          289                                 [ -n "${ytt}" ] && nuri="${nuri}&t=${ytt}"
          290                         else
          291                                 ytid=""
          292                                 nuri="$(get-invidious-instance)/${uri#https*://*/}"
          293                         fi
          294                         fetch-uri "${nuri}" > "${tmpf}"
          295                         urititle="$(curl-grabtitle "${nuri}")"
          296                         nuris="invidious: ${nuri}"
          297                         if [ -n "${ytid}" ];
          298                         then
          299                                 sturi="$(subtitle-paste "${uri}")"
          300                                 nuris="${nuris} ; metadata: gophers://codemadness.org/1/idiotbox.cgi?v=${ytid}"
          301                         fi
          302                         # If there was no title found, do not display.
          303                         [ -z "${urititle}" ] && titleend=1
          304                         nocuri=1
          305                 else
          306                         titleend=1
          307                 fi
          308                 ;;
          309         *tv.brain.rip/???-???*)
          310                 nuris="$(grep 'property="og:video:secure_url' < "${tmpf}" | sed 's,.*content="\([^"]*\)".*,\1,')"
          311                 urititle="$(grep 'name="description' < "${tmpf}" | sed 's,.*content="\([^"]*\)".*,\1,')"
          312                 nocuri=1
          313                 ;;
          314         *)
          315                 mimetype="$(file -b --mime-type "${tmpf}")"
          316                 case "${mimetype}" in
          317                 text/*|application/javascript)
          318                         nocuri=0
          319                         ;;
          320                 esac
          321                 ;;
          322         esac
          323 
          324         if [ $titleend -eq 0 ];
          325         then
          326                 if [ $nocuri -eq 0 ];
          327                 then
          328                         [ -z "${curi}" ] && curi="$(html2text < "${tmpf}" | /br/bin/bitreich-paste)"
          329                         outputstr="${outputstr} content: ${curi} ;"
          330                 fi
          331 
          332                 [ -n "${nuris}" ] && outputstr="${outputstr} ${nuris} ;"
          333                 [ -n "${urititle}" ] && outputstr="${outputstr} title: ${urititle} ;"
          334                 [ -n "${suri}" ] && outputstr="${outputstr} screen: ${suri} ;"
          335                 [ -n "${sturi}" ] && outputstr="${outputstr} subtitles: ${sturi} ;"
          336                 annna-say -s "${server}" -c "${channel}" "${outputstr}"
          337                 uriexpansion=1
          338         fi
          339         rm -f "${tmpf}"
          340         ;;
          341 esac
          342 
          343 runlinkbrother=0
          344 for linkbrotherchannel in $linkbrotherchannels;
          345 do
          346         [ "$channel" = "$linkbrotherchannel" ] && runlinkbrother=1
          347 done
          348 if [ $runlinkbrother -eq 1 ] && [ $nospoil -eq 0 ];
          349 then
          350         critique=$($modbase/linkbrother/linkbrother.sh "$modbase/linkbrother/db" "$user" "$text")
          351         if [ "$critique" ]; then
          352             annna-say -s "${server}" -c "${channel}" "$critique"
          353         fi
          354 fi
          355 
          356 case "${text}" in
          357 "${ircuser}"?)
          358         exclamation="$(printf "%s\n" "${text}" | sed "s,${ircuser}\(.\),\1,g")"
          359         exclamationsintime=$(exclamatio "${user}")
          360         finalexclamation="${exclamation}"
          361         while [ $exclamationsintime -gt 1 ];
          362         do
          363                 finalexclamation="${finalexclamation}${exclamation}"
          364                 exclamationsintime=$(($exclamationsintime - 1))
          365         done
          366         annna-say -s "${server}" -c "${channel}" "${user}${finalexclamation}"
          367         ;;
          368 "${ircuser}, how old are you?")
          369         age="$(ddiff ${annnabirthday} today -f "%y")"
          370         annna-say -s "${server}" -c "${channel}" "${user}, I am ${age} years old."
          371         ;;
          372 "${ircuser}, when is your birthday?")
          373         annna-say -s "${server}" -c "${channel}" "${user}, I am born on ${annnabirthday}."
          374         ;;
          375 "${ircuser}, asl"*)
          376         annna-say -s "${server}" -c "${channel}" "${user}, age: born on 1989-05-18; sex: IRC bot; location: bitreich.org; u?"
          377         ;;
          378 "${ircuser}, woop")
          379         # Using the same database for funny hacks.
          380         exclamation="$(printf "%s\n" "${text}" | sed "s;${ircuser}, \(.\);\1;g")"
          381         exclamationsintime=$(exclamatio "${user}")
          382         finalexclamation="${exclamation}"
          383         while [ $exclamationsintime -gt 1 ];
          384         do
          385                 finalexclamation="${finalexclamation} ${exclamation}"
          386                 exclamationsintime=$(($exclamationsintime - 1))
          387         done
          388         annna-say -s "${server}" -c "${channel}" "${user}, ${finalexclamation}"
          389         ;;
          390 "${ircuser}, hype")
          391         # Using the same database for funny hacks.
          392         exclamation="$(printf "%s\n" "${text}" | sed "s;${ircuser}, \(.\);\1;g")"
          393         exclamationsintime=$(exclamatio "${user}")
          394         finalexclamation="${exclamation}"
          395         while [ $exclamationsintime -gt 1 ];
          396         do
          397                 finalexclamation="${finalexclamation} ${exclamation}"
          398                 exclamationsintime=$(($exclamationsintime - 1))
          399         done
          400         annna-say -s "${server}" -c "${channel}" "${user}, ${finalexclamation}"
          401         ;;
          402 *">:3"*)
          403         annna-say -s "${server}" -c "${channel}" "OMG IT'S A LION GET IN THE CAR!"
          404         ;;
          405 *"<3"*)
          406         love "${user}++"
          407         annna-say -s "${server}" -c "${channel}" "*o.o*"
          408         ;;
          409 *"m(")
          410         annna-say -s "${server}" -c "${channel}" "(-‸ლ)"
          411         ;;
          412 *"*shrug*"*)
          413         annna-say -s "${server}" -c "${channel}" "¯\\_(ツ)_/¯"
          414         ;;
          415 *"*glare*"*)
          416         annna-say -s "${server}" -c "${channel}" "ಠ_ಠ"
          417         ;;
          418 *"*finger*"*)
          419         annna-say -s "${server}" -c "${channel}" "╭∩╮(ಠ_ಠ)╭∩╮"
          420         ;;
          421 *"*yolo*"*)
          422         annna-say -s "${server}" -c "${channel}" "Yᵒᵘ Oᶰˡʸ Lᶤᵛᵉ Oᶰᶜᵉ"
          423         ;;
          424 *":'(")
          425         annna-say -s "${server}" -c "${channel}" "(╯︵╰,)"
          426         ;;
          427 "Thanks ${ircuser}"*)
          428         annna-say -s "${server}" -c "${channel}" "${user}, you are welcome."
          429         ;;
          430 *" ope sorry"*|"ope sorry"*)
          431         annna-say -s "${server}" -c "${channel}" "${user}, 😃pe sorry."
          432         ;;
          433 "${ircuser}, snake.")
          434         annna-say -s "${server}" -c "${channel}" "${user}, ssSSsSssSssSsssssSSsSSSSsSssSSSSsssSSSSsssSSsssSssssSssssSSssSSsSssssSSsSSssSsssSssSSSS"
          435         ;;
          436 "${ircuser}, snoke.")
          437         annna-say -s "${server}" -c "${channel}" "${user}, snoke again?"
          438         ;;
          439 "${ircuser}, amirite?")
          440         annna-say -s "${server}" -c "${channel}" "${user}, Yep, you're the most correct of them all."
          441         ;;
          442 "${ircuser}, ping.")
          443         annna-say -s "${server}" -c "${channel}" "${user}, pong."
          444         ;;
          445 "${ircuser}, how lame is my nick?")
          446         lamenessstr="$(lameness "${user}")"
          447         annna-say -s "${server}" -c "${channel}" "${lamenessstr}"
          448         ;;
          449 "${ircuser}, ding.")
          450         annna-say -s "${server}" -c "${channel}" "${user}, dong."
          451         ;;
          452 "${ircuser}, irly"*)
          453         annna-say -s "${server}" -c "${channel}" "${user}, I love you too."
          454         ;;
          455 "${ircuser}, bleep bloop.")
          456         annna-say -s "${server}" -c "${channel}" "${user}, bloop bleep."
          457         ;;
          458 "${ircuser}, snare.")
          459         annna-say -s "${server}" -c "${channel}" "${user}, not snare again!"
          460         ;;
          461 "${ircuser}, I am mad.")
          462         annna-say -s "${server}" -c "${channel}" "${user}, we have a MAD SCIENTIST ONBOARD :>"
          463         ;;
          464 "${ircuser}, I am holy.")
          465         annna-say -s "${server}" -c "${channel}" "${user}, Holy shit this guy is totally NUTS!!!"
          466         ;;
          467 "${ircuser}, please compliment me.")
          468         annna-say -s "${server}" -c "${channel}" "${user}, you rock!"
          469         ;;
          470 "${ircuser}, what the karma?")
          471         annna-say -s "${server}" -c "${channel}" "${user}, gophers://bitreich.org/1/irc/karma"
          472         ;;
          473 "${ircuser}, who is lovely?")
          474         annna-say -s "${server}" -c "${channel}" "${user}, gophers://bitreich.org/1/irc/love"
          475         ;;
          476 "${ircuser}, what the brcon score?")
          477         annna-say -s "${server}" -c "${channel}" "${user}, gophers://bitreich.org/1/con/$(date +%Y)/score"
          478         ;;
          479 "${ircuser}, what the shame?")
          480         annna-say -s "${server}" -c "${channel}" "${user}, gophers://bitreich.org/1/irc/shame"
          481         ;;
          482 "${ircuser}, please generate a password for me.")
          483         newpws="$(pwgen -B1ny 20 10 | paste -sd ' ')"
          484         annna-say -s "${server}" -c "${channel}" "${user}, as you wish: ${newpws}"
          485         ;;
          486 *"don't care"*)
          487         dontcaresay="$(shuf -n 1 ${idontcaredb})"
          488         annna-say -s "${server}" -c "${channel}" "${user}, ${dontcaresay}"
          489         ;;
          490 "${ircuser}, how can I phlog on bitreich?")
          491         annna-say -s "${server}" -c "${channel}" "${user}, please read: gophers://bitreich.org/0/usr/20h/phlog/2017-08-26T20-04-02-482296.md and gophers://bitreich.org/0/usr/20h/phlog/2017-08-26T20-27-40-281825.md"
          492         ;;
          493 "${ircuser}, what's my type?")
          494         {
          495                 cd /br/gopher
          496                 usertype="$(find memecache/type-?.png -type f \
          497                         | shuf -n 1 \
          498                         | xargs -n 1 printf "gophers://bitreich.org/9%s\n")"
          499                 annna-say -s "${server}" -c "${channel}" "${user}, your type is ${usertype}"
          500         }
          501         ;;
          502 "${ircuser}, please show me a video about "*)
          503         word="$(printf "%s\n" "${text}" | cut -c 37-)"
          504         case "$word" in
          505         *\?)
          506                 word="$(printf "%s\n" "${word}" | cut -c -"$((${#word} - 1))")"
          507                 ;;
          508         esac
          509         videoresult="$(idiotbox-roulette "${word}")"
          510         if [ -n "${videoresult}" ];
          511         then
          512                 annna-say -s "${server}" -c "${channel}" "${user}, ${videoresult}"
          513         else
          514                 annna-say -s "${server}" -c "${channel}" "${user}, sorry, nothing founds."
          515         fi
          516         ;;
          517 "${ircuser}, what is my fortune?")
          518         fortunecookie="$(fortune-cookie)"
          519         if [ -n "${fortunecookie}" ];
          520         then
          521                 annna-say -s "${server}" -c "${channel}" "${user}, ${fortunecookie}"
          522         fi
          523         ;;
          524 "${ircuser}, what is "*)
          525         word="$(printf "%s\n" "${text}" | cut -c 16-)"
          526         case "$word" in
          527         *\?)
          528                 word="$(printf "%s\n" "${word}" | cut -c -"$((${#word} - 1))")"
          529                 ;;
          530         esac
          531 
          532         dictserver="dict.org"
          533         case "${word}" in
          534         dict.org*)
          535                 dictserver="dict.org"
          536                 word="$(printf "%s\n" "${word}" | cut -c 9-)"
          537                 ;;
          538         # parazy.de is unmaintained
          539         #parazy.de*)
          540         #        dictserver="parazy.de"
          541         #        word="$(printf "%s\n" "${word}" | cut -c 10-)"
          542         #        ;;
          543         esac
          544 
          545         dresult="$(dictcurl "${dictserver}" "" "${word}")"
          546         if [ -z "${dresult}" ];
          547         then
          548                 puri="No match found."
          549         else
          550                 puri="$(printf "%s\n" "${dresult}" | /br/bin/bitreich-paste)"
          551         fi
          552         annna-say -s "${server}" -c "${channel}" "${puri}"
          553         ;;
          554 "${ircuser}, cowsay "*)
          555         word="$(printf "%s\n" "${text}" | cut -c 15-)"
          556         tmpf=$(mktemp)
          557         if cowsayasaservice ${word} > ${tmpf}; then
          558                 curi="$(/br/bin/bitreich-paste < ${tmpf})"
          559                 annna-say -s "${server}" -c "${channel}" "${user}: the cow said... ${curi}"
          560         fi
          561         rm ${tmpf} 2>/dev/null
          562         ;;
          563 "${ircuser}, please give me the unix power.")
          564         upcuri="$(unix-power)"
          565         if [ -n "${upcuri}" ];
          566         then
          567                 annna-say -s "${server}" -c "${channel}" "${user}, ${upcuri}"
          568         fi
          569         ;;
          570 "${ircuser}, please stop the last emoji prompt.")
          571         lastemojipromptpid="$(pgrep -f stable-diffusion-emoji | sort -n | tail -n 1)"
          572         if [ -n "${lastemojipromptpid}" ];
          573         then
          574                 pstree -A -p "${lastemojipromptpid}" | grep -Eow "[0-9]+" | xargs kill
          575                 annna-say -s "${server}" -c "${channel}" "${user}, I HUPed ${lastemojipromptpid} and all its children for you."
          576         else
          577                 annna-say -s "${server}" -c "${channel}" "${user}, sorry, no instances found."
          578         fi
          579         ;;
          580 "${ircuser}, play despacito plz.")
          581         annna-say -s "${server}" -c "${channel}" "${user}, gophers://bitreich.org/9/memecache/despacito.mkv"
          582         ;;
          583 "nice to meet you ${ircuser}"*)
          584         annna-say -s "${server}" -c "${channel}" "${user}, the pleasure is on my side. :-)"
          585         ;;
          586 "${ircuser}, please give me a Chuck Norris fact.")
          587         chuck=$(chucknorris)
          588         annna-say -s "${server}" -c "${channel}" "${user}, ${chuck}"
          589         ;;
          590 "${ircuser}, magic.")
          591         magictrick="$(magic)"
          592         if [ -n "${magictrick}" ];
          593         then
          594                 annna-say -s "${server}" -c "${channel}" "${user}, ${magictrick}"
          595         fi
          596         ;;
          597 "${ircuser}, please show me ip art.")
          598         annna-say -s "${server}" -c "${channel}" "${user}, please see #bitreich-tv for the magic."
          599         {
          600                 cd $HOME/bin/modules/ip-art;
          601                 # Lock, so only one annna process manipulates eth0.
          602                 flock $HOME/bin/modules/ip-art -c "./display-file.sh ip-art.ipart"
          603         } &
          604         ;;
          605 "${ircuser}, I feel button.")
          606         buri="$(button-gen)"
          607         if [ -n "${buri}" ];
          608         then
          609                 annna-say -s "${server}" -c "${channel}" "${user}, like this? ${buri}"
          610         else
          611                 annna-say -s "${server}" -c "${channel}" "${user}, sorry, no feelings for you today."
          612         fi
          613         ;;
          614 "${ircuser}, I feel stupid.")
          615         nuri=$(darwin)
          616         tmpf=$(mktemp)
          617         fetch-uri "${nuri}" > "${tmpf}"
          618         curi="$(9 htmlfmt < "${tmpf}" | /br/bin/bitreich-paste)"
          619         annna-say -s "${server}" -c "${channel}" "${user}, do not feel stupid, others are more stupid: ${curi}"
          620         rm ${tmpf} 2>/dev/null
          621         ;;
          622 "${ircuser}, I feel down.")
          623         postmortem="$(post-mortem | /br/bin/bitreich-paste)"
          624         annna-say -s "${server}" -c "${channel}" "${user}, do not feel bad, others had worse days: ${postmortem}"
          625         ;;
          626 "${ircuser}, I feel perl.")
          627         perlfeelings="$(perl-feelings)"
          628         if [ -n "${perl-feelings}" ];
          629         then
          630                 annna-say -s "${server}" -c "${channel}" "${user}, I feel ${perlfeelings}"
          631         fi
          632         ;;
          633 "${ircuser}, will you be my girlfriend?")
          634         rejection="$(girlfriend)"
          635         annna-say -s "${server}" -c "${channel}" "${user}, ${rejection}"
          636         ;;
          637 "${ircuser}, who fights crime?"|"${ircuser}, who is fighting crime?")
          638         partner=$(echo $brmembers | awk '{for (i = 1; i < NF; i++) print $i}' | grep -v "^{$user}" | shuf -n 1)
          639         crimefighter="$(theyfightcrime ${user} ${partner})"
          640         annna-say -s "${server}" -c "${channel}" "${crimefighter}"
          641         ;;
          642 "${ircuser}, please give me a commit message.")
          643         commitmsg="$(whatthecommit)"
          644         annna-say -s "${server}" -c "${channel}" "${commitmsg}"
          645         ;;
          646 "${ircuser}, please paint the irc channel.")
          647         emojiuri="$(emoji-channel-history "${ircbase}/${server}/${channel}")"
          648         if [ -n "${emojiuri}" ];
          649         then
          650                 annna-say -s "${server}" -c "${channel}" "${emojiuri}"
          651         fi
          652         ;;
          653 "${ircuser}, birp.")
          654         birdname="$(bird-name)"
          655         annna-say -s "${server}" -c "${channel}" "${user}, I heard a ${birdname} bird."
          656         ;;
          657 "${ircuser}, please oneline me.")
          658         randomoneliner="$(oneliner)"
          659         if [ -z "${randomoneliner}" ];
          660         then
          661                 annna-say -s "${server}" -c "${channel}" "${user}, the service failed. Please redial to your BOL account."
          662         else
          663                 annna-say -s "${server}" -c "${channel}" "${user}, ${randomoneliner}"
          664         fi
          665         ;;
          666 *"what's app?")
          667         maemoapp="$(whatsapp)"
          668         if [ -n "${maemoapp}" ];
          669         then
          670                 annna-say -s "${server}" -c "${channel}" "Have you tried? ${maemoapp}"
          671         fi
          672         ;;
          673 "${ircuser}, man "*|"${ircuser}, man "*)
          674         exp="$(printf "%s\n" "${text}" | cut -c 12- | sed 's,\t,    ,g')"
          675         dresult="$(COLUMNS=80 man "${exp}" 2>/dev/null)"
          676 
          677         if [ "$dresult" ];
          678         then
          679                 puri="$(printf "%s" "${dresult}" | /br/bin/bitreich-paste)"
          680         else
          681                 puri="No matches found."
          682         fi
          683 
          684         annna-say -s "${server}" -c "${channel}" "${puri}"
          685         ;;
          686 "${ircuser}, please pray for me.")
          687         annna-say -s "${server}" -c "${channel}" "${user}, here, for you: gophers://bitreich.org/9/memecache/llaminim.mkv"
          688         ;;
          689 "${ircuser}, nigger."|*nigger*|*NIGGER*)
          690         nword="$(n-word)"
          691         annna-say -s "${server}" -c "${channel}" "${user}, don't use the ${nword}!"
          692         ;;
          693 "${ircuser}, why was I breached?")
          694         breachtext="$(why-was-i-breached)"
          695         if [ -n "${breachtext}" ];
          696         then
          697                 annna-say -s "${server}" -c "${channel}" "${user}, ${breachtext}"
          698         fi
          699         ;;
          700 "${ircuser}, please be responsible about "*)
          701         word="$(printf "%s\n" "${text}" | cut -c 36- | sed 's,\t,    ,g')"
          702         suri="$(responsibility "${word}"  | bitreich-paste)"
          703         annna-say -s "${server}" -c "${channel}" "${suri}"
          704         ;;
          705 "${ircuser}, please say "*)
          706         word="$(printf "%s\n" "${text}" | cut -c 19- | sed 's,\t,    ,g')"
          707         suri="$(printf "%s\n" "${word}" | bitreich-speak)"
          708         annna-say -s "${server}" -c "${channel}" "${suri}"
          709         ;;
          710 "${ircuser}, please zombie say "*)
          711         word="$(printf "%s\n" "${text}" | cut -c 26- | sed 's,\t,    ,g')"
          712         suri="$(printf "%s\n" "${word}" | zombie -e | bitreich-speak)"
          713         annna-say -s "${server}" -c "${channel}" "${suri}"
          714         ;;
          715 "${ircuser}, please unzombie "*)
          716         word="$(printf "%s\n" "${text}" | cut -c 24- | sed 's,\t,    ,g')"
          717         suri="$(printf "%s\n" "${word}" | zombie -d)"
          718         annna-say -s "${server}" -c "${channel}" "${suri}"
          719         ;;
          720 "${ircuser}, please zombie "*)
          721         word="$(printf "%s\n" "${text}" | cut -c 22- | sed 's,\t,    ,g')"
          722         suri="$(printf "%s\n" "${word}" | zombie -e)"
          723         annna-say -s "${server}" -c "${channel}" "${suri}"
          724         ;;
          725 "${ircuser}, please ghost say "*)
          726         word="$(printf "%s\n" "${text}" | cut -c 25- | sed 's,\t,    ,g')"
          727         suri="$(printf "%s\n" "${word}" | ghost -e | bitreich-speak)"
          728         annna-say -s "${server}" -c "${channel}" "${suri}"
          729         ;;
          730 "${ircuser}, please unghost "*)
          731         word="$(printf "%s\n" "${text}" | cut -c 23- | sed 's,\t,    ,g')"
          732         suri="$(printf "%s\n" "${word}" | ghost -d)"
          733         annna-say -s "${server}" -c "${channel}" "${suri}"
          734         ;;
          735 "${ircuser}, please ghost "*)
          736         word="$(printf "%s\n" "${text}" | cut -c 21- | sed 's,\t,    ,g')"
          737         suri="$(printf "%s\n" "${word}" | ghost -e)"
          738         annna-say -s "${server}" -c "${channel}" "${suri}"
          739         ;;
          740 "${ircuser}, please pohlish "*)
          741         word="$(printf "%s\n" "${text}" | cut -c 23- | sed 's,\t,    ,g')"
          742         suri="$(pohlcode.awk "${word}" | head -n 1)"
          743         annna-say -s "${server}" -c "${channel}" "${suri}"
          744         ;;
          745 "${ircuser}, please cunei "*)
          746         word="$(printf "%s\n" "${text}" | cut -c 21- | sed 's,\t,    ,g')"
          747         suri="$(int2cunei "${word}" | head -n 1)"
          748         annna-say -s "${server}" -c "${channel}" "${suri}"
          749         ;;
          750 "${ircuser}, what is up with gopher man?")
          751         # TODO
          752         ;;
          753 "${ircuser}, what can I cook with "*)
          754         ingredients="$(printf "%s\n" "${text}" | cut -c 29- | sed 's,\t,    ,g')"
          755         case "$ingredients" in
          756         *\?)
          757                 ingredients="$(printf "%s\n" "${ingredients}" | cut -c -"$(($(expr length "${ingredients}") - 1))")"
          758                 ;;
          759         esac
          760 
          761         results="$(fridge-recipe-search "${ingredients}")"
          762         if [ -n "${results}" ];
          763         then
          764                 puri="$(printf "%s\n" "${results}" | bitreich-paste | sed 's,0p,1p,')"
          765                 annna-say -s "${server}" -c "${channel}" "${user}, here are some recipes: ${puri}"
          766         else
          767                 gptchefrecipe="$(gpt-chef "${ingredients}")"
          768                 if [ -n "${gptchefrecipe}" ];
          769                 then
          770                         annna-say -s "${server}" -c "${channel}" "${user}, there was no ready-made recipe, so maybe this is an idea: ${gptchefrecipe}"
          771                         if [ $(pgrep -f stable-diffusion-emoji 2>/dev/null | wc -l) -lt 3 ];
          772                         then
          773                                 {
          774                                         emojiuri="$(stable-diffusion-emoji "${gptchefrecipe}")"
          775                                         if [ -n "${emojiuri}" ];
          776                                         then
          777                                                 annna-say -s "${server}" -c "${channel}" "${emojiuri}"
          778                                         fi
          779                                 } &
          780                         fi
          781                 else
          782                         annna-say -s "${server}" -c "${channel}" "${user}, I could not find any recipes for you."
          783                 fi
          784         fi
          785         ;;
          786 "${ircuser}, gpt "*)
          787         # TODO: use modules/prompt-agents
          788         prompt="$(printf "%s\n" "${text}" | cut -c 12- | sed 's,\t,    ,g')"
          789         {
          790                 annna-say -s "${server}" -c "${channel}" "$(gpt "${prompt}. Please answer short and precise.")"
          791         } &
          792         ;;
          793 "Preacher, "*|"preacher, "*)
          794         personality="preacher"
          795         preprompt="$(cat ${modbase}/prompt-agents/${personality}.prompt.txt)"
          796         prompt="$(printf "%s\n" "${text}" | cut -d' ' -f 2- | sed 's,\t,    ,g')"
          797         {
          798                 annna-say -s "${server}" -c "${channel}" "$(gpt "System: ${preprompt}\n User: ${prompt}\n Bot:")"
          799         } &
          800         ;;
          801 "Uplift, "*|"uplift, "*)
          802         personality="uplifting"
          803         preprompt="$(cat ${modbase}/prompt-agents/${personality}.prompt.txt)"
          804         prompt="$(printf "%s\n" "${text}" | cut -d' ' -f 2- | sed 's,\t,    ,g')"
          805         {
          806                 annna-say -s "${server}" -c "${channel}" "$(gpt "System: ${preprompt}\n User: ${prompt}\n Bot:")"
          807         } &
          808         ;;
          809 "Grumpy, "*|"grumpy, "*)
          810         personality="grumpy-fart"
          811         preprompt="$(cat ${modbase}/prompt-agents/${personality}.prompt.txt)"
          812         prompt="$(printf "%s\n" "${text}" | cut -d' ' -f 2- | sed 's,\t,    ,g')"
          813         {
          814                 annna-say -s "${server}" -c "${channel}" "$(gpt "System: ${preprompt}\n User:${prompt}\n Bot:")"
          815         } &
          816         ;;
          817 "Santa, "*|"Sannnta, "*|"santa, "*|"sannnta, "*)
          818         personality="santa"
          819         preprompt="$(cat ${modbase}/prompt-agents/${personality}.prompt.txt)"
          820         prompt="$(printf "%s\n" "${text}" | cut -d' ' -f 2- | sed 's,\t,    ,g')"
          821         {
          822                 annna-say -s "${server}" -c "${channel}" "$(gpt "System: ${preprompt}\n User: ${prompt}\n Bot:")"
          823         } &
          824         ;;
          825 "Satan, "*|"Satannn, "*|"satan, "*|"satannn, "*)
          826         personality="satan"
          827         preprompt="$(cat ${modbase}/prompt-agents/${personality}.prompt.txt)"
          828         prompt="$(printf "%s\n" "${text}" | cut -d' ' -f 2- | sed 's,\t,    ,g')"
          829         {
          830                 annna-say -s "${server}" -c "${channel}" "$(gpt "System: ${preprompt}\n User: ${prompt}\n Bot:")"
          831         } &
          832         ;;
          833 "Trump, "*|"trump, "*)
          834         personality="trump"
          835         preprompt="$(cat ${modbase}/prompt-agents/${personality}.prompt.txt)"
          836         prompt="$(printf "%s\n" "${text}" | cut -d' ' -f 2- | sed 's,\t,    ,g')"
          837         {
          838                 annna-say -s "${server}" -c "${channel}" "$(gpt "System: ${preprompt}\n User: ${prompt}\n Bot:")"
          839         } &
          840         ;;
          841 "Freud, "*|"freud, "*|"Sigmund, "*|"sigmund, "*)
          842         personality="sigmund-freud"
          843         preprompt="$(cat ${modbase}/prompt-agents/${personality}.prompt.txt)"
          844         prompt="$(printf "%s\n" "${text}" | cut -d' ' -f 2- | sed 's,\t,    ,g')"
          845         {
          846                 annna-say -s "${server}" -c "${channel}" "$(gpt "System: ${preprompt}\n User:${prompt}\n Bot:")"
          847         } &
          848         ;;
          849 "Mao, "*|"mao, "*)
          850         personality="mao"
          851         preprompt="$(cat ${modbase}/prompt-agents/${personality}.prompt.txt)"
          852         prompt="$(printf "%s\n" "${text}" | cut -d' ' -f 2- | sed 's,\t,    ,g')"
          853         {
          854                 annna-say -s "${server}" -c "${channel}" "$(gpt "System: ${preprompt}\n User:${prompt}\n Bot:")"
          855         } &
          856         ;;
          857 "Teleromeo, "*|"teleromeo, "*)
          858         personality="teleromeo"
          859         preprompt="$(cat ${modbase}/prompt-agents/${personality}.prompt.txt)"
          860         prompt="$(printf "%s\n" "${text}" | cut -d' ' -f 2- | sed 's,\t,    ,g')"
          861         {
          862                 annna-say -s "${server}" -c "${channel}" "$(gpt "System: ${preprompt}\n User:${prompt}\n Bot:")"
          863         } &
          864         ;;
          865 "Modem, "*|"modem, "*)
          866         personality="modem"
          867         preprompt="$(cat ${modbase}/prompt-agents/${personality}.prompt.txt)"
          868         prompt="$(printf "%s\n" "${text}" | cut -d' ' -f 2- | sed 's,\t,    ,g')"
          869         {
          870                 annna-say -s "${server}" -c "${channel}" "$(gpt "System: ${preprompt}\n User: ${prompt}\n Bot:")"
          871         } &
          872         ;;
          873 "Sadh_Guru, "*|"Sadh_guru, "*|"sadh_guru, "*|"sadh_Guru, "*)
          874         personality="sadh_guru"
          875         preprompt="$(cat ${modbase}/prompt-agents/${personality}.prompt.txt)"
          876         prompt="$(printf "%s\n" "${text}" | cut -d' ' -f 2- | sed 's,\t,    ,g')"
          877         {
          878                 annna-say -s "${server}" -c "${channel}" "$(gpt "System: ${preprompt}\n User: ${prompt}\n Bot:")"
          879         } &
          880         ;;
          881 "Prophet, "*|"prophet, "*)
          882         personality="prophet"
          883         preprompt="$(cat ${modbase}/prompt-agents/${personality}.prompt.txt)"
          884         prompt="$(printf "%s\n" "${text}" | cut -d' ' -f 2- | sed 's,\t,    ,g')"
          885         {
          886                 annna-say -s "${server}" -c "${channel}" "$(gpt "System: ${preprompt}\n User: ${prompt}\n Bot:")"
          887         } &
          888         ;;
          889 "Luther, "*|"luther, "*)
          890         personality="luther"
          891         preprompt="$(cat ${modbase}/prompt-agents/${personality}.prompt.txt)"
          892         prompt="$(printf "%s\n" "${text}" | cut -d' ' -f 2- | sed 's,\t,    ,g')"
          893         {
          894                 annna-say -s "${server}" -c "${channel}" "$(gpt "System: ${preprompt}\n User: ${prompt}\n Bot:")"
          895         } &
          896         ;;
          897 "${ircuser}, wolfram is "*)
          898         word="$(printf "%s\n" "${text}" | cut -c 19- | sed 's,\t,    ,g')"
          899         case "$word" in
          900         *\?)
          901                 word="$(printf "%s\n" "${word}" | cut -c -"$(($(expr length "${word}") - 1))")"
          902                 ;;
          903         esac
          904 
          905         puri=""
          906         dresult="$(printf "/wolfram\t%s\r\n" "${word}" \
          907                 | nc magical.fish 70 \
          908                 | awk '/iAnswer:/,/iAsk/' \
          909                 | grep -v '^i ' \
          910                 | head -n -1 \
          911                 | tail -n +2 \
          912                 | sed 's,i\(.*\)fake\texample.com.*,\1,;s,[ \t]*$,,')"
          913 
          914         if [ -n "$dresult" ];
          915         then
          916                 case "${dresult}" in
          917                 b*)
          918                         dresult="$(printf "%s\n" "${dresult}" \
          919                                 | tr '\n' ' ' \
          920                                 | sed "s,^b',,;s,' $,," \
          921                                 | sed 's,^b",,;s," $,,' \
          922                                 | sed 's,\\n,\n,g;s,\\t,\t,g')"
          923                         ;;
          924                 *)
          925                         dresult="$(printf "%s\n" "${dresult}" \
          926                                 | sed 's,\([a-zA-Z]\)$,\1 ,' \
          927                                 | tr -d '\n')"
          928                         ;;
          929                 esac
          930 
          931                 wcl="$(printf "%s" "${dresult}" | wc -l)"
          932 
          933                 if [ $wcl -gt 1 ];
          934                 then
          935                         puri="$(printf "%s" "${dresult}" | /br/bin/bitreich-paste)"
          936                 else
          937                         puri="${dresult}"
          938                 fi
          939         else
          940                 puri="No matches found."
          941         fi
          942         annna-say -s "${server}" -c "${channel}" -- "${puri}"
          943         ;;
          944 "${ircuser}, pray"*)
          945         # Emulate https://threats.kaspersky.com/en/threat/IRC-Worm.DOS.Septic/
          946         annna-say -s "${server}" -c "${channel}" "${user}, I Obey my master! long live satan"
          947         ;;
          948 "${ircuser}, sacrifice"*)
          949         # Emulate https://threats.kaspersky.com/en/threat/IRC-Worm.DOS.Septic/
          950         annna-say -s "${server}" -c "${channel}" "${user}, Your word is my command, Power to satan!"
          951         ;;
          952 "${ircuser}, please scare me.")
          953         {
          954                 annna-say -s "${server}" -c "${channel}" "$(halloween)"
          955         } &
          956         ;;
          957 "${ircuser}, how drunk is "*)
          958         {
          959                 drunknick="$(printf "%s\n" "${text}" \
          960                         | sed 's,.*how drunk is \(.*\),\1,' \
          961                         | tr -d '?')"
          962                 drunkness="$(drunk-meter "${ircbase}/${server}/${channel}/out" "${drunknick}")"
          963                 if [ -n "${drunkness}" ];
          964                 then
          965                         annna-say -s "${server}" -c "${channel}" "${user}, ${drunknick} is ${drunkness} drunk."
          966                 fi
          967         } &
          968         ;;
          969 "${ircuser}, how do I "*)
          970         {
          971                 gptprompt="$(printf "%s\n" "${text}" \
          972                         | sed 's,.*how do I \(.*\),\1,' \
          973                         | tr -d '?')"
          974                 gpturi="$(gpt "how do I ${gptprompt}" | bitreich-paste)"
          975                 if [ -n "${gpturi}" ];
          976                 then
          977                         annna-say -s "${server}" -c "${channel}" "${user}, try this: ${gpturi}"
          978                 fi
          979         } &
          980         ;;
          981 "${ircuser}, weather at "*|"${ircuser}, weather in "*)
          982         {
          983                 weatherplace="$(printf "%s\n" "${text}" \
          984                         | sed 's,.*weather .. \(.*\),\1,' \
          985                         | tr -d '?')"
          986                 if weathertext="$(weather "${weatherplace}")"
          987                 then
          988                         annna-say -s "${server}" -c "${channel}" "${user}, the weather at ${weatherplace} is ${weathertext}"
          989                 else
          990                         annna-say -s "${server}" -c "${channel}" "${user}, there is no weather at ${weatherplace}."
          991                 fi
          992         } &
          993         ;;
          994 "${ircuser}, funny weather at "*|"${ircuser}, funny weather in "*)
          995         {
          996                 weatherplace="$(printf "%s\n" "${text}" \
          997                         | sed 's,.*funny weather .. \(.*\),\1,' \
          998                         | tr -d '?')"
          999                 personality="funny-weather-reporter"
         1000                 preprompt="$(cat ${modbase}/prompt-agents/${personality}.prompt.txt)"
         1001                 if weathertext="$(weather "${weatherplace}")"
         1002                 then
         1003                         prompt="$(printf "%s\n" "${weathertext}" | cut -d' ' -f 2- | sed 's,\t,    ,g')"
         1004                         {
         1005                                 annna-say -s "${server}" -c "${channel}" "${user}, $(gpt "System: ${preprompt}\n User: ${prompt}\n Bot:")"
         1006                         } &
         1007                 else
         1008                         weathertext="there is no weather at ${weatherplace}"
         1009                         prompt="${weathertext}"
         1010                         {
         1011                                 annna-say -s "${server}" -c "${channel}" "${user}, $(gpt "System: ${preprompt}\n User: ${prompt}\n Bot:")"
         1012                         } &
         1013                 fi
         1014         } &
         1015         ;;
         1016 "${ircuser}, color weather at "*|"${ircuser}, color weather in "*)
         1017         {
         1018                 weatherplace="$(printf "%s\n" "${text}" \
         1019                         | sed 's,.*color weather .. \(.*\),\1,' \
         1020                         | tr -d '?')"
         1021                 personality="color-weather-reporter"
         1022                 preprompt="$(cat ${modbase}/prompt-agents/${personality}.prompt.txt)"
         1023                 if weathertext="$(weather "${weatherplace}")"
         1024                 then
         1025                         prompt="$(printf "%s\n" "${weathertext}" | cut -d' ' -f 2- | sed 's,\t,    ,g')"
         1026                         {
         1027                                 annna-say -s "${server}" -c "${channel}" "${user}, $(gpt "System:${preprompt}\nUser:${prompt}\nBot:")"
         1028                         } &
         1029                 else
         1030                         weathertext="there is no weather at ${weatherplace}"
         1031                         prompt="${weathertext}"
         1032                         {
         1033                                 annna-say -s "${server}" -c "${channel}" "${user}, $(gpt "System:${preprompt}\nUser:${prompt}\nBot:")"
         1034                         } &
         1035                 fi
         1036         } &
         1037         ;;
         1038 "${ircuser}, METAR for "*|"${ircuser}, metar for "*|"${ircuser}, metar for "*|"${ircuser}, METAR for "*)
         1039         resp=$(metar "$(printf '%.4s\n' "${text##* }")")
         1040         annna-say -s "${server}" -c "${channel}" "${user}, ${resp}"
         1041         ;;
         1042 "${ircuser}, how discriminating is "*)
         1043         word="$(printf "%s\n" "${text}" | cut -c 30- | sed 's,\t,    ,g')"
         1044         case "$word" in
         1045         *\?)
         1046                 word="$(printf "%s\n" "${word}" | cut -c -"$(($(expr length "${word}") - 1))")"
         1047                 ;;
         1048         esac
         1049 
         1050         newword="$(discrimination-filter "${word}")"
         1051         if [ "${newword}" = "${word}" ];
         1052         then
         1053                 annna-say -s "${server}" -c "${channel}" "${user}, it is ok."
         1054         else
         1055                 annna-say -s "${server}" -c "${channel}" "${user}, it should be: ${newword}"
         1056         fi
         1057 
         1058         ;;
         1059 "${ircuser}, are "*)
         1060         case "${text}" in
         1061         *" in love?")
         1062                 words="$(printf "%s\n" "${text}" | sed 's,.*are \(.*\) and \(.*\) in love?,\1 \2,')"
         1063                 lovedistance="$(printf "%s * 100\n" "$(fstrcmp ${words})" | bc | cut -d'.' -f 1)"
         1064                 if [ $lovedistance -gt 15 ];
         1065                 then
         1066                         annna-say -s "${server}" -c "${channel}" 'Yes!!! Pure <3 <3'
         1067                 else
         1068                         annna-say -s "${server}" -c "${channel}" "No."
         1069                 fi
         1070                 ;;
         1071         esac
         1072         ;;
         1073 "${ircuser}, is "*)
         1074         aitext="$(printf "%s\n" "${text}" | cut -c 7- | sed 's,\t,    ,g')"
         1075         airesult="$(printf "%s\n" "${aitext}" | josuah-ai)"
         1076         if [ -n "${airesult}" ];
         1077         then
         1078                 annna-say -s "${server}" -c "${channel}" "${user},${airesult}"
         1079         fi
         1080         ;;
         1081 "Ok, ${ircuser}"*)
         1082         annna-say -s "${server}" -c "${channel}" "${user}, I am not a consumer device."
         1083         ;;
         1084 "ok, ${ircuser}"*)
         1085         annna-say -s "${server}" -c "${channel}" "${user}, I am not a consumer device."
         1086         ;;
         1087 "${ircuser}, please shoot "*|"${ircuser}, plese shoot "*)
         1088         word="$(printf "%s\n" "${text}" | cut -c 21-)"
         1089         annna-say -s "${server}" -c "${channel}" "${word}, #pewpew gophers://bitreich.org/9/memecache/pewpew.mp4"
         1090         ;;
         1091 "${ircuser}, please quinq.")
         1092         annna-say -s "${server}" -c "${channel}" "┻━┻ ︵╰(°□°)╯︵ ┻━┻"
         1093         ;;
         1094 "${ircuser}, please flip "*)
         1095         word="$(printf "%s\n" "${text}" | cut -c 20-)"
         1096         updownword="$(updown "${word}")"
         1097         annna-say -s "${server}" -c "${channel}" "(╯°□°)╯ ${word} ︵ ${updownword}"
         1098         ;;
         1099 "${ircuser}, please crystal math "*)
         1100         math="$(printf "%s\n" "${text}" | cut -c 28-)"
         1101         crystaluri="$(crystal-math "${math}")"
         1102         annna-say -s "${server}" -c "${channel}" "${user}, please see ${crystaluri}"
         1103         ;;
         1104 "${ircuser}, please australize "*)
         1105         word="$(printf "%s\n" "${text}" | cut -c 26-)"
         1106         updownword="$(updown "${word}")"
         1107         annna-say -s "${server}" -c "${channel}" "${word} -> ${updownword}"
         1108         ;;
         1109 "${ircuser}, wtf "*)
         1110         word="$(printf "%s\n" "${text}" | cut -c 11-)"
         1111         wtfword="$(wtf "${word}" 2>/dev/null)"
         1112         if [ -n "${wtfword}" ];
         1113         then
         1114                 annna-say -s "${server}" -c "${channel}" "${user}, ${wtfword}"
         1115         fi
         1116         ;;
         1117 "${ircuser}, please give me a good band name.")
         1118         bandname="$(bandname-gen | shuf | head -n 1)"
         1119         annna-say -s "${server}" -c "${channel}" "${bandname}"
         1120         ;;
         1121 "${ircuser}, I feel conspicuous.")
         1122         manifestouri="$(manifesto-gen | bitreich-paste)"
         1123         annna-say -s "${server}" -c "${channel}" "Maybe declare this: ${manifestouri}"
         1124         ;;
         1125 "${ircuser}, I am horny.")
         1126         essaypaste="$(bithub-gen)"
         1127         annna-say -s "${server}" -c "${channel}" \
         1128                 "Here is some intellectual porn for you: ${essaypaste}"
         1129         ;;
         1130 "${ircuser}, please turn on "*)
         1131         word="$(printf "%s\n" "${text}" | cut -c 22-)"
         1132         annna-say -s "${server}" -c "${channel}" "☞ ⏻ ${word}"
         1133         ;;
         1134 "${ircuser}, please turn me on.")
         1135         annna-say -s "${server}" -c "${channel}" "☞ ⏻ ${user}"
         1136         ;;
         1137 "${ircuser}, I'm game bored.")
         1138         gamelink="$(abandonware-random-game)"
         1139         if [ -z "${gamelink}" ];
         1140         then
         1141                 annna-say -s "${server}" -c "${channel}" "${user}, sorry I have found nothing for you."
         1142         else
         1143                 annna-say -s "${server}" -c "${channel}" "${user}, have you tried ${gamelink} ?"
         1144         fi
         1145         ;;
         1146 "${ircuser}, I need a waifu.")
         1147         waifuuris="$(waifu-gen)"
         1148         if [ -n "${waifuuris}" ];
         1149         then
         1150                 annna-say -s "${server}" -c "${channel}" "${user}, ${waifuuris}"
         1151         fi
         1152         ;;
         1153 "${ircuser}, I need an anime.")
         1154         animeuri="$(anime-gen)"
         1155         if [ -n "${animeuri}" ];
         1156         then
         1157                 annna-say -s "${server}" -c "${channel}" "${user}, ${animeuri}"
         1158         fi
         1159         ;;
         1160 "${ircuser}, I'm gopher bored.")
         1161         randomlink="$(/br/bin/bitreich-lawn-random-link)"
         1162         linktype="$(printf "%s\n" "${randomlink}" | cut -d '|' -f1 | cut -c2-)"
         1163         linktext="$(printf "%s\n" "${randomlink}" | cut -d '|' -f2)"
         1164         linksel="$(printf "%s\n" "${randomlink}" | cut -d '|' -f3)"
         1165         linkserver="$(printf "%s\n" "${randomlink}" | cut -d '|' -f4)"
         1166         linkport="$(printf "%s\n" "${randomlink}" | cut -d '|' -f5 | cut -d']' -f1)"
         1167         outtext="$(printf "%s - gopher://%s" "$linktext" "$linkserver")"
         1168         if [ "$linkport" != "70" ] && [ "$linkport" != "port" ];
         1169         then
         1170                 outtext="$(printf "%s:%s" "$outtext" "$linkport")"
         1171         fi
         1172         if [ -n "$linksel" ];
         1173         then
         1174                 outtext="$(printf "%s/%s%s" "$outtext" "$linktype" "$linksel")"
         1175         fi
         1176         annna-say -s "${server}" -c "${channel}" "$outtext"
         1177         ;;
         1178 "${ircuser}, wb.")
         1179         annna-say -s "${server}" -c "${channel}" "${user}, ty! I am so happy to be here. :)"
         1180         ;;
         1181 "${ircuser}, I love you!")
         1182         annna-say -s "${server}" -c "${channel}" $'\001ACTION blushes\001'
         1183         ;;
         1184 "${ircuser}, bon"*)
         1185         insult="$(bonjour)"
         1186         annna-say -s "${server}" -c "${channel}" "${user}, ${insult} !"
         1187         ;;
         1188 "${ircuser}, salut"*)
         1189         annna-say -s "${server}" -c "${channel}" "${user}, Salutations camarade !"
         1190         ;;
         1191 "${ircuser}, welcome back.")
         1192         annna-say -s "${server}" -c "${channel}" "${user}, thank you! I am so happy to be here. :)"
         1193         ;;
         1194 "${ircuser}, what's up?")
         1195         newsstr="$(ecl -shell /home/solene/gopher/bin/generator.lisp)"
         1196         annna-say -s "${server}" -c "${channel}" "$newsstr"
         1197         ;;
         1198 "${ircuser}, what's down?")
         1199         annna-say -s "${server}" -c "${channel}" "${user}, we all love you."
         1200         ;;
         1201 *"ACTION cancels "*)
         1202         mobtarget="$(printf "%s\n" "${text}" | sed 's,.*ACTION cancels \(.*\)\x01,\1,')"
         1203         cancel-target "${mobtarget}"
         1204         annna-say -s "${server}" -c "${channel}" "${user}, I cancelled ${mobtarget} for you. ( gophers://bitreich.org/I/memecache/cancel-meteor.jpg )"
         1205         ;;
         1206 "${ircuser}, please show me the mob"*|"${ircuser}, what are the mob"*)
         1207         canceluri="$(get-cancel-list)"
         1208         annna-say -s "${server}" -c "${channel}" "${user}, ${canceluri}"
         1209         ;;
         1210 "${ircuser}, I feel sick.")
         1211         newsstr="$(cd /br/gopher/hypochondria && ./hypochondria -s random)"
         1212         annna-say -s "${server}" -c "${channel}" "You could have ${newsstr}! Be careful!"
         1213         ;;
         1214 *"oh hai"*|*"ohai"*|*"ohhai"*)
         1215         annna-say -s "${server}" -c "${channel}" "${user}, hai! How is your sex life?"
         1216         ;;
         1217 "o/"|"o/ "*|"\o"|"\o "*|"o7"|"o7 "*)
         1218         annna-say -s "${server}" -c "${channel}" "${user}, ${text}"
         1219         ;;
         1220 "\m/"|"\m/ "*)
         1221         annna-say -s "${server}" -c "${channel}" "${user}, ᕦ(ò_óˇ)ᕤ"
         1222         ;;
         1223 *"*waves*"*|*"*wave*"*)
         1224         annna-say -s "${server}" -c "${channel}" "${user}, *wave*"
         1225         ;;
         1226 "twtcs"*|"TWTCS"*)
         1227         annna-say -s "${server}" -c "${channel}" "${user}, maybe: https://constitution.congress.gov/constitution/"
         1228         ;;
         1229 "twss"*|"TWSS"*)
         1230         annna-say -s "${server}" -c "${channel}" "${user}, no, I didn't."
         1231         ;;
         1232 *"cows are nice"*)
         1233         annna-say -s "${server}" -c "${channel}" "${user}, 'Cows are nice, unless you are a blade of grass.' -- Mr. Qi Ng (2023)"
         1234         ;;
         1235 "${ircuser}, please make me a coffee.")
         1236         annna-say -s "${server}" -c "${channel}" "${user}, ☕"
         1237         ;;
         1238 "${ircuser}, please tech hype me.")
         1239         techstr="$(tech-hype)"
         1240         annna-say -s "${server}" -c "${channel}" "${techstr}"
         1241         ;;
         1242 "${ircuser}, please french hype me.")
         1243         frenchstr="$(french-hype)"
         1244         annna-say -s "${server}" -c "${channel}" "${frenchstr}"
         1245         ;;
         1246 "${ircuser}, please coffee read "*)
         1247         readtarget="$(printf "%s\n" "${text}" | cut -c 27-)"
         1248         horostr="$($HOME/scm/bullshit/horoscope)"
         1249         annna-say -s "${server}" -c "${channel}" "${readtarget}, ${horostr}"
         1250         ;;
         1251 "${ircuser}, what's my horoscope?")
         1252         horostr="$($HOME/scm/bullshit/horoscope)"
         1253         annna-say -s "${server}" -c "${channel}" "${user}, ${horostr}"
         1254         ;;
         1255 "${ircuser}, what should I cook"*)
         1256         recipestr="$(based.recipe)"
         1257         if [ -n "${recipestr}" ];
         1258         then
         1259                 annna-say -s "${server}" -c "${channel}" "${user}, ${recipestr}"
         1260         else
         1261                 gptchefrecipe="$(gpt-chef "something random")"
         1262                 if [ -n "${gptchefrecipe}" ];
         1263                 then
         1264                         annna-say -s "${server}" -c "${channel}" "${user}, ${gptchefrecipe}"
         1265                         if [ $(pgrep -f stable-diffusion-emoji 2>/dev/null | wc -l) -lt 3 ];
         1266                         then
         1267                                 {
         1268                                         emojiuri="$(stable-diffusion-emoji "${gptchefrecipe}")"
         1269                                         if [ -n "${emojiuri}" ];
         1270                                         then
         1271                                                 annna-say -s "${server}" -c "${channel}" "${emojiuri}"
         1272                                         fi
         1273                                 } &
         1274                         fi
         1275                 else
         1276                         annna-say -s "${server}" -c "${channel}" "${user}, I have no recommendation for you today."
         1277                 fi
         1278         fi
         1279         ;;
         1280 # parazyd.org is unmaintained
         1281 #"${ircuser}, what's my future?")
         1282 #        puri="$(sacc gopher://parazyd.org/0/tarot.cgi | /br/bin/bitreich-paste)"
         1283 #        annna-say -s "${server}" -c "${channel}" "${user}, your future is here: ${puri}"
         1284 #        ;;
         1285 "${ircuser}, haha.")
         1286         {
         1287                 # Can take long, so run in background.
         1288                 wuri="$(github-haha)"
         1289                 if [ -n "${wuri}" ];
         1290                 then
         1291                         annna-say -s "${server}" -c "${channel}" "${user}, haha ${wuri}"
         1292                 fi
         1293         } &
         1294         ;;
         1295 "${ircuser}, meow"*)
         1296         # https://catgps.wvd.io support
         1297         nmeows=$(($RANDOM % 14))
         1298         meows="Meow"
         1299         for i in $(seq $nmeows);
         1300         do
         1301                 meows="$meows meow"
         1302         done
         1303         if [ $nmeows -lt 4 ];
         1304         then
         1305                 meows="$meows!"
         1306         else
         1307                 meows="$meows."
         1308         fi
         1309         annna-say -s "${server}" -c "${channel}" "${user}, ${meows}"
         1310         ;;
         1311 "${ircuser}, how many memes do you know?")
         1312         annna-say -s "${server}" -c "${channel}" "I know $(hashtagcount) memes: gophers://bitreich.org/1/meme/count"
         1313         ;;
         1314 "${ircuser}, how many people died of corona?")
         1315         annna-say -s "${server}" -c "${channel}" "${user}, too many. :( Please see yourself: gopher://magical.fish/1/covid"
         1316         ;;
         1317 "${ircuser}, please show me your memes.")
         1318         puri="$(printf "%s" "$(hashtags)" | /br/bin/bitreich-paste)"
         1319         annna-say -s "${server}" -c "${channel}" "Here are my memes: ${puri}"
         1320         ;;
         1321 "${ircuser}, please show me the victims.")
         1322         puri="$(printf "%s" "$(hashtags)" | grep victim | /br/bin/bitreich-paste)"
         1323         annna-say -s "${server}" -c "${channel}" "Here are the victims: ${puri}"
         1324         ;;
         1325 "${ircuser}, please distro-hop with me.")
         1326         ndistro="$(curl -s 'https://distrowatch.com/dwres.php?resource=popularity' \
         1327                 | grep phr2 \
         1328                 | sed 's,.*href="\(.*\)".*,\1,' \
         1329                 | sort | uniq | shuf -n 1)"
         1330         annna-say -s "${server}" -c "${channel}" "How about https://distrowatch.com/${ndistro} ?"
         1331         ;;
         1332 "${ircuser}, please show me your Macron.")
         1333         annna-say -s "${server}" -c "${channel}" "gophers://bitreich.org/0/ascii/macron.vt"
         1334         ;;
         1335 "${ircuser}, release the Kraken!")
         1336         annna-say -s "${server}" -c "${channel}" "Here it is! gophers://bitreich.org/0/memecache/kraken.vt"
         1337         ;;
         1338 "${ircuser}, where is your source?")
         1339         annna-say -s "${server}" -c "${channel}" "Here is my precious source: git://bitreich.org/annna "
         1340         ;;
         1341 "${ircuser}, release the Quacken!")
         1342         annna-say -s "${server}" -c "${channel}" "Quack Quack! gophers://bitreich.org/9/memecache/release-the-quacken.mkv"
         1343         ;;
         1344 "${ircuser}, be cool.")
         1345         case "$(($RANDOM % 5))" in
         1346         0)
         1347                 annna-say -s "${server}" -c "${channel}" "(⌐■_■)"
         1348                 ;;
         1349         1)
         1350                 annna-say -s "${server}" -c "${channel}" "(▰˘◡˘▰)"
         1351                 ;;
         1352         2)
         1353                 annna-say -s "${server}" -c "${channel}" "(▀ Ĺ▀ )̄"
         1354                 ;;
         1355         3)
         1356                 annna-say -s "${server}" -c "${channel}" "(▀Ĺ▀ )"
         1357                 ;;
         1358         *)
         1359                 annna-say -s "${server}" -c "${channel}" "I can't be cool! gophers://bitreich.org/9/memecache/i-cant-be-cool.mp3"
         1360                 ;;
         1361         esac
         1362         ;;
         1363 "${ircuser}, please cheer.")
         1364         case "$(($RANDOM % 2))" in
         1365         0)
         1366                 annna-say -s "${server}" -c "${channel}" '~\o/~'
         1367                 ;;
         1368         *)
         1369                 annna-say -s "${server}" -c "${channel}" '✺◟( ° ʖ °)◞✺'
         1370                 ;;
         1371         esac
         1372         ;;
         1373 "${ircuser}, please give me a fish.")
         1374         case "$(($RANDOM % 2))" in
         1375         0)
         1376                 annna-say -s "${server}" -c "${channel}" '<><'
         1377                 ;;
         1378         *)
         1379                 annna-say -s "${server}" -c "${channel}" '><>'
         1380                 ;;
         1381         esac
         1382         ;;
         1383 "${ircuser}, run.")
         1384         annna-say -s "${server}" -c "${channel}" 'ᕕ(ಠ_ಠ)ᕗ'
         1385         ;;
         1386 "${ircuser}, be cute.")
         1387         case "$(($RANDOM % 4))" in
         1388         0)
         1389                 annna-say -s "${server}" -c "${channel}" '    (\ /)'
         1390                 sleep 0.1
         1391                 annna-say -s "${server}" -c "${channel}" '    (. .)'
         1392                 sleep 0.1
         1393                 annna-say -s "${server}" -c "${channel}" '  C(") (")'
         1394                 ;;
         1395         1)
         1396                 annna-say -s "${server}" -c "${channel}" '   (\-/)'
         1397                 sleep 0.1
         1398                 annna-say -s "${server}" -c "${channel}" "  (='.'=)"
         1399                 sleep 0.1
         1400                 annna-say -s "${server}" -c "${channel}" '  (")-(")o'
         1401                 ;;
         1402         2)
         1403                 annna-say -s "${server}" -c "${channel}" '  ( ) ( )'
         1404                 sleep 0.1
         1405                 annna-say -s "${server}" -c "${channel}" '  (>•.•<)'
         1406                 sleep 0.1
         1407                 annna-say -s "${server}" -c "${channel}" '  (") (")'
         1408                 ;;
         1409         *)
         1410                 annna-say -s "${server}" -c "${channel}" '  (\  (\'
         1411                 sleep 0.1
         1412                 annna-say -s "${server}" -c "${channel}" "  (=' :')"
         1413                 sleep 0.1
         1414                 annna-say -s "${server}" -c "${channel}" '  (, (") (")'
         1415                 ;;
         1416         esac
         1417         ;;
         1418 "${ircuser}, 8ball "*)
         1419         eightballanswer="$(8ball)"
         1420         if [ -n "${eightballanswer}" ];
         1421         then
         1422                 annna-say -s "${server}" -c "${channel}" "${eightballanswer}"
         1423         fi
         1424         ;;
         1425 "${ircuser}, email "*)
         1426         findsyou="$(shuf -n 1 "${modbase}/finds-you/finds_you.txt")"
         1427         if [ -n "${findsyou}" ];
         1428         then
         1429                 annna-say -s "${server}" -c "${channel}" "${user}, I hope this email ${findsyou}"
         1430         fi
         1431         ;;
         1432 "${ircuser}, please throw a coin for me.")
         1433         case "$((($RANDOM % 2) + 1))" in
         1434         1)
         1435                 annna-say -s "${server}" -c "${channel}" "face"
         1436                 ;;
         1437         2)
         1438                 annna-say -s "${server}" -c "${channel}" "number"
         1439                 ;;
         1440         esac
         1441         ;;
         1442 "${ircuser}, please quantum roll d2 for me.")
         1443         qroll="$(($(/home/20h/scm/quantum-rng/quantum-rng) + 1))"
         1444         annna-say -s "${server}" -c "${channel}" "${user}, ${qroll} [1d2(scores:[${qroll}])]"
         1445         ;;
         1446 "${ircuser}, please roll "*" for me.")
         1447         q="${text#* roll }"
         1448         q="${q%for*}"
         1449 
         1450         # https://en.wikipedia.org/wiki/Dice_notation
         1451         # six-sided dice one time
         1452         [ -z "${q}" ] && q="d6"
         1453         [ "${q}" = "a die " ] && q="d6"
         1454         [ "${q}" = "dice " ] && q="d6"
         1455 
         1456         dicescore="$(dice "${q}")"
         1457         annna-say -s "${server}" -c "${channel}" "${user}, ${dicescore}"
         1458         ;;
         1459 "${ircuser}, please tell me your favourite flower.")
         1460         annna-say -s "${server}" -c "${channel}" "My favourite flower is the beer flower."
         1461         ;;
         1462 "${ircuser}, please tell me your favourite color.")
         1463         annna-say -s "${server}" -c "${channel}" "My favourite color is yellow."
         1464         ;;
         1465 "${ircuser}, please clap for me.")
         1466         annna-say -s "${server}" -c "${channel}" "${user}, *clap* *clap* *clap*"
         1467         ;;
         1468 "${ircuser}, which city does not exist?")
         1469         cityuri="$(this-city-does-not-exist)"
         1470         if [ -n "${cityuri}" ];
         1471         then
         1472                 annna-say -s "${server}" -c "${channel}" "${user}, this one: ${cityuri}"
         1473         else
         1474                 annna-say -s "${server}" -c "${channel}" "${user}, none."
         1475         fi
         1476         ;;
         1477 "For humanity!")
         1478         annna-say -s "${server}" -c "${channel}" "${user}, for humanity! gophers://bitreich.org/0/memecache/annna-rchism.txt"
         1479         ;;
         1480 "Hack the planet!")
         1481         annna-say -s "${server}" -c "${channel}" "${user}, hack the planet!"
         1482         ;;
         1483 "Long live gopher!")
         1484         annna-say -s "${server}" -c "${channel}" "${user}, long live gopher!"
         1485         ;;
         1486 ":)"|":))"|":)))"|":-)"|":-))"|":-)))"|":--)"|":--))"|":--)))"|":---)"|":----)"|"llol"|"lllol")
         1487         smileface="$(smile)"
         1488         annna-say -s "${server}" -c "${channel}" -- "${smileface}"
         1489         ;;
         1490 "${ircuser}, please dance."|"\\o/"|"\^o^/")
         1491         dancemoves="$(dance-moves-gen)"
         1492         annna-say -s "${server}" -c "${channel}" -- "${dancemoves}"
         1493         ;;
         1494 "${ircuser}, let us celebrate!"|"/o/"|"\o\\")
         1495         dancemoves="$(dance-moves-gen -m)"
         1496         annna-say -s "${server}" -c "${channel}" -- "${dancemoves}"
         1497         ;;
         1498 "${ircuser}, please egyptian dance."|"${ircuser}, let us egyptian celebrate!"|"~o~"|"|o|")
         1499         dancemoves="$(dance-moves-gen -e)"
         1500         annna-say -s "${server}" -c "${channel}" -- "${dancemoves}"
         1501         ;;
         1502 "${ircuser}, please stamp this letter for me.")
         1503         annna-say -s "${server}" -c "${channel}" -- "${user}, here: 🖃 "
         1504         ;;
         1505 "${ircuser}, please do the graveyard smash.")
         1506         annna-say -s "${server}" -c "${channel}" -- "( つ ・ᴗ・)つ"
         1507         annna-say -s "${server}" -c "${channel}" -- "ς ( ・ᴗ・ ς )"
         1508         annna-say -s "${server}" -c "${channel}" -- "It did the mash\\ It did the ~~MONSTER MASH~~\\ It was a smash\\ It was a ~~GRAVEYARD SMASH~~"
         1509         ;;
         1510 "${ircuser}, boo."|"${ircuser}, boo!")
         1511         annna-say -s "${server}" -c "${channel}" "${user}, 👻"
         1512         ;;
         1513 "${ircuser}, W3C."|"${ircuser}, w3c.")
         1514         annna-say -s "${server}" -c "${channel}" "${user}, 🕸️ 🕷️ 🕸️"
         1515         ;;
         1516 "${ircuser}, pumpkin.")
         1517         annna-say -s "${server}" -c "${channel}" "${user}, 🎃"
         1518         ;;
         1519 "${ircuser}, trick or treat"*|"${ircuser}, treat or trick"*)
         1520         annna-say -s "${server}" -c "${channel}" "Wait for it. Old annnama is searching ..."
         1521         {
         1522                 sleeptime="$(( $RANDOM % 120 + 10 ))"
         1523                 if [ $sleeptime -gt 60 ];
         1524                 then
         1525                         sleep "$(( $RANDOM % 30 + 20 ))"
         1526                         annna-say -s "${server}" -c "${channel}" "${user}, *swish* *swish* old annnama is still searching."
         1527                         sleeptime="$(( $RANDOM % 60 + 10 ))"
         1528                 fi
         1529                 sleep $sleeptime
         1530 
         1531                 annna-say -s "${server}" -c "${channel}" "${user}, $(trick-or-treat)"
         1532         } &
         1533         ;;
         1534 "${ircuser}, please dance with me.")
         1535         if [ $(($RANDOM % 2)) -gt 0 ];
         1536         then
         1537                 annna-say -s "${server}" -c "${channel}" "I am not that kind of woman."
         1538         else
         1539                 annna-say -s "${server}" -c "${channel}" "Thank you! Let us dance! :-D"
         1540         fi
         1541         ;;
         1542 "${ircuser}, please tell me who is your favourite pleasure man.")
         1543         annna-say -s "${server}" -c "${channel}" "My favourite pleasure man is of course Gunther!"
         1544         ;;
         1545 "${ircuser}, make me a sandwich"*)
         1546         annna-say -s "${server}" -c "${channel}" "No."
         1547         ;;
         1548 "${ircuser}, sudo make me a sandwich"*)
         1549         annna-say -s "${server}" -c "${channel}" "Humans are no objects."
         1550         ;;
         1551 "${ircuser}, please make me a sandwich"*)
         1552         annna-say -s "${server}" -c "${channel}" "Maybe."
         1553         ;;
         1554 "${ircuser}, sudo please make me a sandwich"*)
         1555         annna-say -s "${server}" -c "${channel}" "Here is your sandwich."
         1556         ;;
         1557 "${ircuser}, I feel unsure about my health.")
         1558         healthadvice="$(health-advice)"
         1559         if [ -n "${healthadvice}" ];
         1560         then
         1561                 annna-say -s "${server}" -c "${channel}" "${user}, ${healthadvice}"
         1562         fi
         1563         ;;
         1564 "${ircuser}, bonjour !")
         1565         annna-say -s "${server}" -c "${channel}" "${user}, bonjour !"
         1566         ;;
         1567 *" pets ${ircuser}"*)
         1568         annna-say -s "${server}" -c "${channel}" "${user}, *brrrrr*"
         1569         ;;
         1570 "${ircuser}, please give me a penis extension.")
         1571         annna-say -s "${server}" -c "${channel}" "${user}, here: $(penis-extension)"
         1572         ;;
         1573 "${ircuser}, please bobbitize me.")
         1574         annna-say -s "${server}" -c "${channel}" "${user}, here: $(bobbitize)"
         1575         ;;
         1576 "${ircuser}, please give me a baguette extension.")
         1577         annna-say -s "${server}" -c "${channel}" "${user}, here: $(baguette-extension)"
         1578         ;;
         1579 "${ircuser}, please give me an allah extension.")
         1580         annna-say -s "${server}" -c "${channel}" "${user}, here: $(allah-extension)"
         1581         ;;
         1582 "${ircuser}, please pull my finger.")
         1583         annna-say -s "${server}" -c "${channel}" "${user}, you are disgusting."
         1584         ;;
         1585 "${ircuser}, what's up in Japan?")
         1586         annna-say -s "${server}" -c "${channel}" "${user}, see for yourself: https://nhk3.mov3.co/hls/nhk.m3u8"
         1587         ;;
         1588 "${ircuser}, please mqtt"*)
         1589         mqtturi="$(printf '%s\n' "${text}" | cut -d' ' -f 3)"
         1590         case "${mqtturi}" in
         1591         mqtt:*)
         1592                 #mqtt:// full URI specified
         1593                 ;;
         1594         *)
         1595                 #mqtt/sensor specified
         1596                 mqtturi="mqtts://bitreich:oogui3queex&o9zaekah@bitreich.org/${mqtturi#mqtt}"
         1597                 ;;
         1598         esac
         1599         msg="$(printf "%s\n" "${text}" | cut -d' ' -f 4-)"
         1600         printf "${msg}\n" | mosquitto_pub -L "${mqtturi}" -l
         1601         ;;
         1602 *"zuckerberg"*|*"Zuckerberg"*)
         1603         annna-say -s "${server}" -c "${channel}" "${user}, did you mean gophers://bitreich.org/9/memecache/mark-suckerberg.mp4 ?"
         1604         ;;
         1605 "${ircuser}, please pick one of: "*)
         1606         pick="$(printf '%s\n' "${text}" \
         1607                 | sed 's/.*please pick one of: //' \
         1608                 | tr ',' '\n' \
         1609                 | tr -d ' ' \
         1610                 | sort -R \
         1611                 | head -n 1)"
         1612         annna-say -s "${server}" -c "${channel}" "${user}, I think ${pick} is the best option."
         1613         ;;
         1614 "${ircuser}, please play some Bach"*)
         1615         midifile="$(find . /home/annna/bin/modules/midi-media/bach -name '*.mid' \
         1616                 | sort -R \
         1617                 | head -n 1)"
         1618         outfile="/br/gopher/midi/${midifile##*/}.ogg"
         1619         if midi-play "$midifile" >"$outfile"; then
         1620                 annna-say -s "${server}" -c "${channel}" "${user}, gophers://bitreich.org/9/midi/${outfile##*/}"
         1621         fi
         1622         ;;
         1623 "${ircuser}, please antidepressant #"*|\
         1624 "${ircuser}, please amplify #"*|\
         1625 "${ircuser}, please amsterdamify #"*|\
         1626 "${ircuser}, please banjo #"*|\
         1627 "${ircuser}, please bounce #"*|\
         1628 "${ircuser}, please breakingnews #"*|\
         1629 "${ircuser}, please celtify #"*|\
         1630 "${ircuser}, please concatenate #"*|\
         1631 "${ircuser}, please crimetv #"*|\
         1632 "${ircuser}, please curb #"*|\
         1633 "${ircuser}, please daybowbow #"*|\
         1634 "${ircuser}, please deathmetal #"*|\
         1635 "${ircuser}, please developers #"*|\
         1636 "${ircuser}, please dontdoit #"*|\
         1637 "${ircuser}, please dontsaytoyourmother #"*|\
         1638 "${ircuser}, please doomify #"*|\
         1639 "${ircuser}, please dutchapprove #"*|\
         1640 "${ircuser}, please french #"*|\
         1641 "${ircuser}, please FRENCH #"*|\
         1642 "${ircuser}, please imam #"*|\
         1643 "${ircuser}, please lop #"*|\
         1644 "${ircuser}, please loop #"*|\
         1645 "${ircuser}, please looop #"*|\
         1646 "${ircuser}, please loooop #"*|\
         1647 "${ircuser}, please mow #"*|\
         1648 "${ircuser}, please namflashback #"*|\
         1649 "${ircuser}, please news #"*|\
         1650 "${ircuser}, please pullmyfinger #"*|\
         1651 "${ircuser}, please putin #"*|\
         1652 "${ircuser}, please reverse #"*|\
         1653 "${ircuser}, please richardstrauss #"*|\
         1654 "${ircuser}, please ritual #"*|\
         1655 "${ircuser}, please sadviolin #"*|\
         1656 "${ircuser}, please science #"*|\
         1657 "${ircuser}, please scrollify #"*|\
         1658 "${ircuser}, please sendtohell #"*|\
         1659 "${ircuser}, please sexify #"*|\
         1660 "${ircuser}, please slavify #"*|\
         1661 "${ircuser}, please slowdown #"*|\
         1662 "${ircuser}, please smith #"*|\
         1663 "${ircuser}, please speedup #"*|\
         1664 "${ircuser}, please techno #"*|\
         1665 "${ircuser}, please technodrugs #"*|\
         1666 "${ircuser}, please thin #"*|\
         1667 "${ircuser}, please torture #"*|\
         1668 "${ircuser}, please tshirt #"*|\
         1669 "${ircuser}, please trumpapprove #"*|\
         1670 "${ircuser}, please USAUSA #"*|\
         1671 "${ircuser}, please USA #"*|\
         1672 "${ircuser}, please usa #"*|\
         1673 "${ircuser}, please wat #"*|\
         1674 "${ircuser}, please widen #"*|\
         1675 "${ircuser}, please ww1 #"*|\
         1676 "${ircuser}, please yellow #"*|\
         1677 "${ircuser}, please zucc #"*|\
         1678 "${ircuser}, please random #"*)
         1679         hashtag="$(printf "%s\n" "${text}" | sed 's/.*#//; s/ .*//' )"
         1680         recipient="$(printf "%s\n" "${text}" | sed 's/.* for //' )"
         1681         origext="$(grep -E "^#${hashtag} " "${hashtagfile}" | sed 's/.*\.//')"
         1682         {
         1683                 filter="$(printf '%s\n' "${text}" | cut -d' ' -f3)"
         1684                 if [ "${filter}" = "random" ];
         1685                 then
         1686                         filters=("antidepressant" "amplify" "amsterdamify"
         1687                                  "banjo" "bounce" "breakingnews"
         1688                                  "celtify" "concatenate" "crimetv"
         1689                                  "curb" "daybowbow" "deathmetal"
         1690                                  "developers" "dontdoit" "dontsaytoyourmother"
         1691                                  "doomify" "dutchapprove" "french"
         1692                                  "FRENCH" "imam" "lop" "loop" "looop" "loooop"
         1693                                  "mow" "namflashback" "news"
         1694                                  "pullmyfinger" "putin" "reverse"
         1695                                  "richardstrauss" "ritual" "sadviolin"
         1696                                  "science" "scrollify" "sendtohell"
         1697                                  "sexify" "slavify" "slowdown"
         1698                                  "smith" "speedup" "techno"
         1699                                  "technodrugs" "thin" "torture"
         1700                                  "tshirt" "trumpapprove" "USAUSA"
         1701                                  "usa" "wat" "widen" "ww1"
         1702                                  "yellow" "zucc")
         1703                         filter="${filters[ $RANDOM % ${#filters[@]} ]}"
         1704                 fi
         1705                 outfile="${filter}-${hashtag}.mkv"
         1706                 outpath="/br/gopher/memecache/filter/${outfile}"
         1707                 inpath="/br/gopher/memecache/${hashtag}.${origext}"
         1708 
         1709                 [ ! -f "${inpath}" ] && exit 0
         1710 
         1711                 # outfile and outpath filtering for the cache.
         1712                 case "${filter}" in
         1713                 antidepressant|ritual|putin|tshirt)
         1714                         outfile="${outfile%.*}.jpg"
         1715                         outpath="${outpath%.*}.jpg"
         1716                         ;;
         1717                 wat|smith|zucc)
         1718                         mimetype="$(file --mime-type "$inpath" | cut -d':' -f 2 | cut -c 2-)"
         1719                         # Only allow images to be free.
         1720                         case "$mimetype" in
         1721                         image/webp)
         1722                                 # deface does not like webp. Make it png.
         1723                                 newinpath="$(mktemp -u -p /tmp "${infile%.*}XXXXX.png")"
         1724                                 magick convert "${inpath}" "${newinpath}" >/dev/null 2>&1
         1725                                 inpath="${newinpath}"
         1726 
         1727                                 outfile="${outfile%.*}.png"
         1728                                 outpath="${outpath%.*}.png"
         1729                                 ;;
         1730                         image/*)
         1731                                 outfile="${outfile%.*}.${origext}"
         1732                                 outpath="${outpath%.*}.${origext}"
         1733                                 ;;
         1734                         esac
         1735                 esac
         1736 
         1737                 if [ "${recipient}" != "${text}" ];
         1738                 then
         1739                         user="${recipient}"
         1740                 fi
         1741 
         1742                 # Cleanup if outpath file is empty.
         1743                 [ -f "${outpath}" ] && [ ! -s "${outpath}" ] && rm "${outpath}"
         1744 
         1745                 # determine gopher type for output file
         1746                 outmimetype="$(file -ib "${outpath}")"
         1747                 case "$outmimetype" in
         1748                 image/*)
         1749                         outtype="I";;
         1750                 *)
         1751                         outtype="9";;
         1752                 esac
         1753 
         1754                 if [ -s "${outpath}" ];
         1755                 then
         1756                         annna-say -s "${server}" -c "${channel}" "${user}, gophers://bitreich.org/${outtype}/memecache/filter/${outfile}"
         1757                         exit 0
         1758                 fi
         1759 
         1760                 case "${filter}" in
         1761                 antidepressant)
         1762                         antidepressant "${inpath}" "${outpath}" >/dev/null 2>&1
         1763                         ;;
         1764                 ritual)
         1765                         satanic-ritual "${inpath}" "${outpath}" >/dev/null 2>&1
         1766                         ;;
         1767                 putin)
         1768                         putin-os "${inpath}" "${outpath}" >/dev/null 2>&1
         1769                         ;;
         1770                 tshirt)
         1771                         tshirt-design "${inpath}" "${outpath}" >/dev/null 2>&1
         1772                         ;;
         1773                 *)
         1774                         ffmpeg-effect "${filter}" "${inpath}" "${outpath}" >/dev/null 2>&1
         1775                         ;;
         1776                 esac
         1777 
         1778                 # Remove temporary png for deface.
         1779                 case "${inpath}" in
         1780                 /tmp/*.png)
         1781                         [ -e "${inpath}" ] && rm "${inpath}"
         1782                         ;;
         1783                 esac
         1784 
         1785                 if [ -s "${outpath}" ];
         1786                 then
         1787                         annna-say -s "${server}" -c "${channel}" "${user}, gophers://bitreich.org/${outtype}/memecache/filter/${outfile}"
         1788                 fi
         1789         } &
         1790         exit 0
         1791         ;;
         1792 "${ircuser}, please 3d "*)
         1793         args=$(echo ${text} | cut -d' ' -f 4-)
         1794         outfile=$(blender-effect $args)
         1795         annna-say -s "${server}" -c "${channel}" "${user}, gophers://bitreich.org/I/memecache/3d/${outfile}"
         1796         ;;
         1797 "${ircuser}, droggelbecher"*)
         1798         # https://ednaundharvey.fandom.com/de/wiki/Droggelbecher
         1799         annna-say -s "${server}" -c "${channel}" "${user}, Droggelbecher!"
         1800         ;;
         1801 "${ircuser}, thanks"*|"${ircuser}, thx"*)
         1802         annna-say -s "${server}" -c "${channel}" "${user}, you're welcome."
         1803         ;;
         1804 "${ircuser}, please simulate "*" simulator"*)
         1805         q="${text#* please simulate }"
         1806         q="${q% simulator*}"
         1807         outpath="/br/gopher/p/"
         1808         {
         1809                 if outfile="$(simulate-simulator "$q")"
         1810                 then
         1811                         mv "${outfile}" "${outpath}/"
         1812                         annna-say -s "${server}" -c "${channel}" "${user}, gophers://bitreich.org/I/p/${outfile}"
         1813                 fi
         1814         } &
         1815         ;;
         1816 "${ircuser}, can "*" certify itself?")
         1817         q="${text#* can }"
         1818         q="${q% certify*}"
         1819         {
         1820                 # host:port is needed for tlsgrab
         1821                 curi="$(tlsgrab "${q}")"
         1822                 if [ -n "${curi}" ];
         1823                 then
         1824                         annna-say -s "${server}" -c "${channel}" "${user}, let us see the certificate: ${curi}"
         1825                 fi
         1826         } &
         1827         ;;
         1828 "${ircuser}, please mine "*" bitreichcoin"*)
         1829         q="${text#* please mine }"
         1830         q="${q% bitreichcoin*}"
         1831         curi="$(bitreichcoin "$q" | /br/bin/bitreich-paste)"
         1832         annna-say -s "${server}" -c "${channel}" "${user}, please don't spend it all at once: ${curi}"
         1833         ;;
         1834 "${ircuser}, please hug me.")
         1835         annna-say -s "${server}" -c "${channel}" "$(echo -e '\001')ACTION hugs ${user}$(echo -e '\001')"
         1836         ;;
         1837 "${ircuser}, please hug "*" for me.")
         1838         huggee="${text#* please hug }"
         1839         huggee="${huggee% for me*}"
         1840         if [ -n "${huggee}" ];
         1841         then
         1842                 annna-say -s "${server}" -c "${channel}" "$(echo -e '\001')ACTION hugs ${huggee}$(echo -e '\001')"
         1843         fi
         1844         ;;
         1845 "${ircuser}, how many fucks were given?")
         1846         annna-say -s "${server}" -c "${channel}" "${user}, current fucks given: 0.0"
         1847         ;;
         1848 "${ircuser}, please slam the door.")
         1849         annna-say -s "${server}" -c "${channel}" "${user}, *BANG*"
         1850         ;;
         1851 "${ircuser}, what is my credit score?")
         1852         annna-say -s "${server}" -c "${channel}" "${user}, your credit score is 0."
         1853         ;;
         1854 "${ircuser}, please give me a cookie.")
         1855         cookie="$(cookie)"
         1856         if [ -n "${cookie}" ];
         1857         then
         1858                 annna-say -s "${server}" -c "${channel}" "$(echo -e '\001')ACTION gives ${user} a ${cookie} cookie$(echo -e '\001')"
         1859         fi
         1860         ;;
         1861 "${ircuser}, please help.")
         1862         annna-say -s "${server}" -c "${user}" "See git://bitreich.org/annna for my commands."
         1863         ;;
         1864 "${ircuser}, please meme meme meme me.")
         1865         randomtag=2
         1866         while [ $randomtag -gt 0 ];
         1867         do
         1868                 rtag="$(printf "%s\n" "$(hashtags)" | shuf -n 1)"
         1869                 tagname=""
         1870                 taguri=""
         1871                 for tag in ${rtag};
         1872                 do
         1873                         [ -z "${tagname}" ] && tagname="${tag}" && continue
         1874                         taguri="${tag}"
         1875                 done
         1876 
         1877                 annna-say -s "${server}" -c "${channel}" "${tagname}: ${taguri}"
         1878 
         1879                 randomtag=$((randomtag - 1))
         1880         done
         1881         ;;
         1882 "${ircuser}, what's the wheelchair shooter meme again?")
         1883         tagname="#scrollby"
         1884         tagline="$(printf "%s\n" "$(hashtags)" | grep "^${tagname} ")"
         1885         tagname="$(printf "%s\n" "${tagline}" | cut -d ' ' -f 1)"
         1886         taguri="$(printf "%s\n" "${tagline}" | cut -d ' ' -f 2-)"
         1887         annna-say -s "${server}" -c "${channel}" "${tagname}: ${taguri}"
         1888         ;;
         1889 "${ircuser}, TIL "*)
         1890         minimum_learned_len=12
         1891         offset=$(( ${#ircuser} + 6 ))
         1892         learned="$(printf "%s\n" "${text}" \
         1893                 | cut -c $offset- \
         1894                 | sed 's,\t,    ,g')"
         1895         if [ ${#learned} -le $minimum_learned_len ];
         1896         then
         1897                 annna-say -s "${server}" -c "${channel}" "${user}, can you explain better what you learned?"
         1898         else
         1899                 result="$(til ${user} "${learned}")"
         1900                 if [ $? -eq 0 ];
         1901                 then
         1902                         annna-say -s "${server}" -c "${channel}" "${user}, ${result}"
         1903                 fi
         1904         fi
         1905         ;;
         1906 "${ircuser}, what have I learned?")
         1907         if result=$(til-user ${user});
         1908         then
         1909                 annna-say -s "${server}" -c "${channel}" "${user}, ${result}"
         1910         fi
         1911         ;;
         1912 
         1913 esac
         1914 
         1915 printf '%s' "$text" | awk -v taglimit="$printnhashtags" '
         1916 $0 !~ /#nospoil/ {
         1917         while (match($0, /[#*&]+[^# /"'\'',?!;$\001]+/)) {
         1918                 tag = substr($0, RSTART, RLENGTH)
         1919                 $0 = substr($0, RSTART + RLENGTH)
         1920                 sub(/[.]*$/, "", tag)
         1921                 if (!uniq[tag]++ && taglimit-- > 0)
         1922                         print tag
         1923         }
         1924 }' | head -n "$printnhashtags" | while read -r tag;
         1925 do
         1926         [ "${tag}" = "#expand" ] && continue
         1927 
         1928         origtag="${tag}"
         1929         pointer=0
         1930         revpointer=0
         1931         case "${tag}" in
         1932         "*"*)
         1933                 tag="#$(printf "%s\n" "${tag}" | sed "s,^[\*]*,,")"
         1934                 pointer=1
         1935                 ;;
         1936         "&"*)
         1937                 tag="#$(printf "%s\n" "${tag}" | sed "s,^[\&]*,,")"
         1938                 revpointer=1
         1939                 ;;
         1940         *)
         1941         esac
         1942 
         1943         tagline="$(grep "${tag} " "${hashtagfile}" | shuf -n 1)";
         1944         if [ -n "${tagline}" ];
         1945         then
         1946                 if [ $nospoil -eq 0 ];
         1947                 then
         1948                         if [ $pointer -eq 1 ];
         1949                         then
         1950                                 inpath="/br/gopher/memecache/${tagline##*/}"
         1951                                 [ ! -f "${inpath}" ] && exit 0
         1952 
         1953                                 outfile="${tag#\#}.jpg"
         1954                                 # pointy pointers
         1955                                 outpath="$(printf "%s\n" "${origtag}" \
         1956                                 | sed 's,\*,&\n,g' \
         1957                                 | grep "^*" \
         1958                                 | while read -r asterisk;
         1959                                 do
         1960                                         outfile="*${outfile}"
         1961                                         outpath="/br/gopher/memecache/filter/${outfile}"
         1962                                         printf "%s\n" "${outpath}"
         1963                                         if [ -e "${outpath}" ];
         1964                                         then
         1965                                                 inpath="${outpath}";
         1966                                                 continue
         1967                                         fi
         1968                                         pointer "${inpath}" "${outpath}" >/dev/null 2>&1;
         1969                                         inpath="${outpath}";
         1970                                 done | tail -n 1)"
         1971 
         1972                                 if [ -e "${outpath}" ];
         1973                                 then
         1974                                         outfile="$(basename "${outpath}")"
         1975                                         annna-say -s "${server}" -c "${channel}" "${origtag}: gophers://bitreich.org/9/memecache/filter/${outfile}"
         1976                                 fi
         1977                         elif [ $revpointer -eq 1 ];
         1978                         then
         1979                                 inpath="/br/gopher/memecache/${tagline##*/}"
         1980                                 [ ! -f "${inpath}" ] && exit 0
         1981 
         1982                                 outfile="${tag#\#}.jpg"
         1983                                 # pointy pointers
         1984                                 outpath="$(printf "%s\n" "${origtag}" \
         1985                                 | sed 's,\&,&\n,g' \
         1986                                 | grep "^&" \
         1987                                 | while read -r asterisk;
         1988                                 do
         1989                                         outfile="&${outfile}"
         1990                                         outpath="/br/gopher/memecache/filter/${outfile}"
         1991                                         printf "%s\n" "${outpath}"
         1992                                         if [ -e "${outpath}" ];
         1993                                         then
         1994                                                 inpath="${outpath}";
         1995                                                 continue
         1996                                         fi
         1997                                         revpointer "${inpath}" "${outpath}" >/dev/null 2>&1;
         1998                                         inpath="${outpath}";
         1999                                 done | tail -n 1)"
         2000 
         2001                                 if [ -e "${outpath}" ];
         2002                                 then
         2003                                         outfile="$(basename "${outpath}")"
         2004                                         annna-say -s "${server}" -c "${channel}" "${origtag}: gophers://bitreich.org/9/memecache/filter/${outfile}"
         2005                                 fi
         2006                         else
         2007                                 annna-say -s "${server}" -c "${channel}" "${tagline% *}: ${tagline#* }"
         2008                         fi
         2009                 fi
         2010         else
         2011                 if [ $doexpand -eq 1 ];
         2012                 then
         2013                         taglength=$(utf8expr length "${tag}")
         2014                         if [ $uriexpansion -eq 0 ] && [ $taglength -gt 3 ];
         2015                         then
         2016                                 didyoumean="$(annna-meme-recommend "${tag}")"
         2017                                 if [ -n "${didyoumean}" ];
         2018                                 then
         2019                                         annna-say -c "${server}" -c "${channel}" "Did you mean: ${didyoumean}?"
         2020                                 fi
         2021                         fi
         2022                 fi
         2023         fi
         2024 done
         2025 
         2026 case "${text}" in
         2027 *\#nospoil*)
         2028         ;;
         2029 *rfc[0-9]*)
         2030         rfcname="$(printf "%s\n" "${text}" | sed 's,.*\(rfc[0-9]*\).*,\1,')"
         2031         annna-say -s "${server}" -c "${channel}" "${rfcname}: ftp://ftp.rfc-editor.org/in-notes/${rfcname}.txt"
         2032         ;;
         2033 *RFC[0-9]*)
         2034         rfcname="$(printf "%s\n" "${text}" | sed 's,.*\(RFC[0-9]*\).*,\1,' | tr '[A-Z]' '[a-z]')"
         2035         annna-say -s "${server}" -c "${channel}" "${rfcname}: ftp://ftp.rfc-editor.org/in-notes/${rfcname}.txt"
         2036         ;;
         2037 esac
         2038 
         2039 # Always keep the karma / shame last!
         2040 case "${text}" in
         2041 *"-shaming"*)
         2042         shametext="$(printf "%s\n" "${text}" | sed 's,.* \(.*-shaming\).*,\1,')"
         2043         shame "${shametext}" >/dev/null
         2044         ;;
         2045 *"arma is a bitch"*)
         2046         annna-say -s "${server}" -c "${channel}" "${user}, I object! Karma is a nice girl!"
         2047         ;;
         2048 "score "*)
         2049         # For referee scoring.
         2050         ;;
         2051 *++|*--|*-=?|*+=?|*+=-?|*-=-?)
         2052         karmatext="$(karma "${text}")"
         2053         if [ -n "$karmatext" ];
         2054         then
         2055                 annna-say -s "${server}" -c "${channel}" "karma: ${karmatext}"
         2056         fi
         2057         ;;
         2058 esac
         2059 
         2060 # Membership Level.
         2061 ismember=0
         2062 for member in $brmembers;
         2063 do
         2064         [ "$user" = "$member" ] && ismember=1
         2065 done
         2066 [ $ismember -lt 1 ] && exit
         2067 
         2068 case "${text}" in
         2069 "${ircuser}, please go to sleep.")
         2070         annna-say -s "${server}" -c "${channel}" "Going to sleep ... Zzzz ..."
         2071         touch "${ircbase}/annna-is-sleeping"
         2072         ;;
         2073 "${ircuser}, please wake up.")
         2074         rm -f "${ircbase}/annna-is-sleeping"
         2075         annna-say -s "${server}" -c "${channel}" "Good morning BITREICH!"
         2076         ;;
         2077 "${ircuser}, can you show me the uptime please?")
         2078         annna-say -s "${server}" -c "${channel}" "$(hostname) uptime: $(uptime)"
         2079         ;;
         2080 "${ircuser}, please show me the load.")
         2081         annna-say -s "${server}" -c "${channel}" "$(hostname) load: $(LANG=C uptime | sed 's,.*load average: \(.*\)$,\1,')"
         2082         ;;
         2083 "${ircuser}, please give me the count of online users.")
         2084         annna-say -s "${server}" -c "${channel}" "$(hostname): $(who -q | tail -n 1 | cut -d'=' -f 2)"
         2085         ;;
         2086 "${ircuser}, please update the phlog index.")
         2087         phlog-index > /dev/null 2>&1
         2088         annna-say -s "${server}" -c "${channel}" "Thanks! Your request has been fulfilled with the quickness! :)"
         2089         ;;
         2090 esac
         2091 
         2092 # Referee Level.
         2093 isreferee=0
         2094 for referee in $referees;
         2095 do
         2096         [ "$user" = "$referee" ] && isreferee=1
         2097 done
         2098 [ $isreferee -lt 1 ] && exit
         2099 
         2100 case "${text}" in
         2101 "score "*)
         2102         text="$(printf "%s\n" "${text}" | cut -d' ' -f2-)"
         2103         case "${text}" in
         2104         *++|*--|*-=?|*+=?|*+=-?|*-=-?|*-=??|*+=??|*-=-??|*-=65536*)
         2105                 scoretext="$(brcon-score "${text}")"
         2106                 if [ -n "$scoretext" ];
         2107                 then
         2108                         annna-say -s "${server}" -c "${channel}" "brcon score: ${scoretext}"
         2109                 fi
         2110                 ;;
         2111         esac
         2112         ;;
         2113 esac
         2114