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