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 (61254B)
       ---
            1 #!/bin/bash
            2 
            3 [ "${IRC_CMD_USER}" = "${IRC_USER}" ] && exit 0
            4 [ -z "${IRC_PRIVMSG_TEXT}" ] && exit 0
            5 [ ! "$IRC_CMD" = "PRIVMSG" ] && exit 1
            6 [ "${IRC_CHANNEL}" = "${IRC_USER}" ] && IRC_CHANNEL="${IRC_CMD_USER}"
            7 
            8 export PATH="$PATH:/br/bin"
            9 
           10 annnasumerian="𒈹"
           11 annnabirthday="1989-05-18"
           12 hashtagfile="${ANNNA_MODBASE}/hashtags/hashtags.txt"
           13 idontcaredb="${ANNNA_MODBASE}/i-dont-care/i-dont-care.txt"
           14 printnhashtags=2
           15 brmembers="__20h__ Evil_Bob chripo posativ quinq stateless solene josuah parazyd bin KatolaZ adc Athas roygbyte ROYGBYTE pazz0"
           16 referees="__20h__"
           17 ignorednicks="eidolon"
           18 linkbrotherchannels="#bitreich-meme"
           19 # Flag, if some expansion of some URI happened.
           20 uriexpansion=0
           21 # Do not spoil at all.
           22 nospoil=0
           23 # Enforce spoiling in case of hard nospoil filter.
           24 dospoil=0
           25 # Expand meme hashtag and show recommendations.
           26 doexpand=0
           27 
           28 # Personalities.
           29 declare -A personalities
           30 add_personality() {
           31         for personality in "$@";
           32         do
           33                 personalities+=(["${personality}"]="$1")
           34         done
           35 }
           36 for person in preacher uplift trump mao teleromeo modem orphet luther sadh_guru boss god software-exorcist jesus;
           37 do
           38         add_personality "${person}"
           39 done
           40 add_personality grumpy-fart grumpy
           41 add_personality santa sannnta
           42 add_personality satan satannn
           43 add_personality sigmund-freud freud sigmund
           44 add_personality kinski klaus
           45 
           46 regeximatch() {
           47         printf '%s' "$1" | grep -i -E -q "$2"
           48 }
           49 hashtags() {
           50         cat ${hashtagfile} 2>/dev/null
           51 }
           52 hashtagcount() {
           53         int2bit "$(curl -s gophers://bitreich.org/1/meme/count \
           54                 | grep total \
           55                 | head -n 1 \
           56                 | sed 's,.*total on .*: \([0-9]*\)),\1,')"
           57 }
           58 
           59 alias_call() {
           60         export IRC_PRIVMSG_TEXT="$@"
           61         exec $0 "$@"
           62 }
           63 
           64 isignored=0
           65 for ignorednick in $ignorednicks;
           66 do
           67         [ "$user" = "$ignorednick" ] && isignored=1
           68 done
           69 [ $isignored -eq 1 ] && exit
           70 
           71 case "${IRC_PRIVMSG_TEXT}" in
           72 *\#nospoil*) nospoil=1;;
           73 *\#expand*) doexpand=1;;
           74 *::*::*)
           75         if [ $(pgrep -f stable-diffusion-emoji 2>/dev/null | wc -l) -gt 3 ];
           76         then
           77                 annna-say "${IRC_CMD_USER}, sorry, gophers://bitreich.org/I/memecache/bitreich-burning.png"
           78         else
           79                 {
           80                         query=${IRC_PRIVMSG_TEXT#**::} query=${query%%::*}
           81                         emojiuri="$(stable-diffusion-emoji "${query}")"
           82                         if [ -n "${emojiuri}" ];
           83                         then
           84                                 if [ -n "${IRC_CMD_USER}" ] && [ "${IRC_CMD_USER}" != "annna-cmd" ];
           85                                 then
           86                                         annna-say "${IRC_CMD_USER}, ${emojiuri}"
           87                                 else
           88                                         annna-say "${emojiuri}"
           89                                 fi
           90                         fi
           91                 } &
           92         fi;;
           93 *http*://*|*ytdl://*)
           94         case "${IRC_PRIVMSG_TEXT}" in
           95         *"#spoil"*) dospoil=1;;
           96         esac
           97 
           98         case "${IRC_PRIVMSG_TEXT}" in
           99         *http*://*)
          100                 uri="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" \
          101                         | sed -n '/.*\(https\{0,1\}:\/\/[^ ]\{1,\}\).*/s//\1/p')"
          102                 ;;
          103         *ytdl://*)
          104                 ytid="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" \
          105                         | sed -n '/.*ytdl:\/\/\([^ ]\{1,\}\).*/s//\1/p')"
          106                 uri="$(printf "https://www.youtube.com/watch?v=%s" "${ytid}")"
          107                 ;;
          108         esac
          109 
          110         # Set below and annna will concatenate at the end.
          111         # HTML title.
          112         urititle=""
          113         # Subtitle URI.
          114         sturi=""
          115         # Replacement URI.
          116         nuri=""
          117         # Replacement URI display string.
          118         nuris=""
          119         # html2text content.
          120         curi=""
          121         # Set to 0, if some URI content should be shown.
          122         nocuri=1
          123         # Screenshot.
          124         suri=""
          125 
          126         # titleend=1 will not output any further.
          127         titleend=0
          128         outputstr=""
          129 
          130         if is-invidious-instance "${uri}";
          131         then
          132                 host="$(printf "%s\n" "${uri}" \
          133                         | sed 's,.*://\([^/]*\).*,\1,')"
          134                 if [ -n "${host}" ];
          135                 then
          136                         uri="$(printf "%s\n" "${uri}" \
          137                                 | sed "s,${host},youtube.com,")"
          138                 fi
          139         fi
          140 
          141         tmpf=$(mktemp)
          142         fetch-uri "${uri}" > "${tmpf}"
          143         if [ ! -s "${tmpf}" ];
          144         then
          145                 archiveorguri="$(archiveorg-uri "${uri}")"
          146                 if [ -n "${archiveorguri}" ];
          147                 then
          148                         sarchiveorguri="$(bitreich-uri-shortener "${archiveorguri}")"
          149                         nuris="archive: ${sarchiveorguri}"
          150                         fetch-uri "${archiveorguri}" > "${tmpf}"
          151                 fi
          152         fi
          153         [ -s "${tmpf}" ] && urititle="$(grabtitle < "${tmpf}" | cut -c -84)"
          154 
          155         case "${urititle}" in
          156         "");;
          157         *Gunther*|*GUNTHER*|*Günther*|*GÜNTHER*)
          158                 annna-say "Oh Günther! ❤  ❤  ❤  ${urititle}"
          159                 uriexpansion=1;;
          160         *\|\ Cloudflare*|"Just a moment...")
          161                 annna-say "Mind your own business! We got clownflared: gophers://bitreich.org/0/ascii/clownflare.vt"
          162                 titleend=1
          163                 uriexpansion=1;;
          164         esac
          165 
          166         case "${uri}" in
          167         "");;
          168         *github.com/*/blob/*)
          169                 urltitle=""
          170                 nuris="$(printf '%s' "${uri}" | sed 's/blob/raw/')"
          171                 nocuri=0;;
          172         *imgur.com/*) nuris="$(youtube-dl -g "${uri}")" || nuris="";;
          173         *xkcd.com/*) nuris="$(xkcd-uri "${uri}")";;
          174         *imdb.com/title/*)
          175                 # TODO: Imdb.com is now complete javascript shit.
          176                 #imdbstr="$(imdb2gopherbay "${uri}")"
          177                 #if [ -n "${imdbstr}" ];
          178                 #then
          179                 #        nuris="${imdbstr}"
          180                 #        urititle=""
          181                 #fi;;
          182                 ;;
          183         *themoviedb.org/movie/*)
          184                 movietitle="$(themoviedb2gopherbay "${uri}" | sed 's, ,+,g')"
          185                 [ -n "${movietitle}" ] && nuris="${movietitle}";;
          186         *lichess.org/????????|*lichess.org/????????/|*lichess.org/????????/black|*lichess.org/????????/white)
          187                 nuris="$(printf "%s\n" "${uri}" \
          188                         | sed 's,https://lichess.org\(/[^ ]*\)$,\1,; s,^/\([^/]*\)/black$,/black/\1,; s,/white,,; s,\(.*\),https://lichess1.org/game/export/gif\1.gif,;')"
          189                 ;;
          190         *npr.org/*)
          191                 post="$(printf '%s\n' "${uri}" | sed -n 's@.*/\([0-9]\{10\}\)/.*$@\1@p')"
          192                 if [ -n "${post}" ];
          193                 then
          194                         nuri="https://text.npr.org/${post}"
          195                         nuris="text only: ${nuri}"
          196                 fi;;
          197         *csdb.dk/release/*)
          198                 sid=$(awk '/<a href="download\.php.*\.sid/ { match($0, /https:\/\/.*\.sid</); print substr($0, RSTART, RLENGTH-1); exit }' "$tmpf")
          199                 [ -n "$sid" ] && nuris="listen: $sid";;
          200         *www.forgottenweapons.com/*)
          201                 ytid=$(sed -n '/<meta name="description"/ s/.*https:\/\/youtu\.be\/\([-A-Za-z0-9_]\{11\}\).*/\1/p' "$tmpf")
          202                 if [ -n "$ytid" ]; then
          203                         nuris="video: ytdl://$ytid ;"
          204                         nuris="$nuris metadata: gophers://codemadness.org/1/idiotbox.cgi?v=$ytid"
          205                 fi;;
          206         *www.reddit.com*)
          207                 nuri="$(printf '%s\n' "${uri}" | sed "s;www.reddit.com;old.reddit.com;")"
          208                 nuris="old.reddit: ${nuri}"
          209                 fetch-uri "${nuri}" > "${tmpf}"
          210                 if [ -n "${uri#*www.reddit.com/r/*}" ];
          211                 then
          212                         subreddit="$(printf '%s\n' "${uri}" | cut -d / -f 5)"
          213                         post="$(printf '%s\n' "${uri}" | cut -d / -f 7)"
          214                         if [ -n "${post}" ];
          215                         then
          216                                 guri="gopher://gopherddit.com/1/cgi-bin/reddit.cgi?view&${post}&${subreddit}&10"
          217                         else
          218                                 guri="gopher://gopherddit.com/1/cgi-bin/reddit.cgi?menu&${subreddit}&10"
          219                         fi
          220                         nuris="${nuri} ; gopherdit: ${guri}"
          221                 fi
          222                 nocuri=0;;
          223         *taz.de*)
          224                 newsid="$(printf '%s\n' "${uri}" | sed 's,.*\(![0-9]*\).*,\1,')"
          225                 if [ -n "${newsid}" ];
          226                 then
          227                         urititle="$(curl-grabtitle "${uri}")"
          228                         nuris="gopher://taz.de/1/${newsid}"
          229                         nocuri=1
          230                 fi;;
          231         *x.com/*/status/*)
          232                 tid="$(printf "%s\n" "${uri}" | sed 's,.*status/\([0-9]*\)$,\1,')"
          233                 # X.com/Twitter sucks and hates users.
          234                 nocuri=1;;
          235         *fosdem.org/*/schedule/event/*)
          236                 ngateremark="$(fosdem-n-gate "${uri}")"
          237                 if [ -n "${ngateremark}" ];
          238                 then
          239                         nuris="n-gate: ${ngateremark}"
          240                         nocuri=1
          241                 fi;;
          242         *en.wikipedia.org/wiki/*)
          243                 if ! regeximatch "$uri" '\.(jpg,bmp,gif,png,tiff,avi,mp4,webm,mkv,pdf,ps,eps)$';
          244                 then
          245                         nuri="$(printf '%s\n' "${uri}" | sed -Ee "s;http.*wikipedia\.org/wiki;gophers://bitreich.org/0/pedia/txt;" -e "s;(\?|#).*$;;")"
          246                         nuris="${nuris} $(printf 'txt: %s' "${nuri}")"
          247                         nocuri=1
          248                 fi;;
          249         *.wikipedia.org/wiki/*)
          250                 if ! regeximatch "$uri" '\.(jpg,bmp,gif,png,tiff,avi,mp4,webm,mkv,pdf,ps,eps)$';
          251                 then
          252                         nuri="$(printf '%s\n' "${uri}" | sed -Ee "s;/wiki/;/api/rest_v1/page/pdf/;" -e "s;(\?|#).*$;;")"
          253                         nuris="$(printf 'pdf: %s\n' "${nuri}")"
          254                         nocuri=1
          255                 fi;;
          256         *youtube.com/*|*youtu.be/*)
          257                 # Youtube is so annoying and repeatedly broken;
          258                 # they hate users, only expand on request.
          259                 if [ $dospoil -eq 1 ];
          260                 then
          261                         if [ -z "${uri##*youtu.be/*}" ] \
          262                                 || [ -z "${uri##*/watch?v=*}" ] \
          263                                 || [ -z "${uri##*/embed/*}" ] \
          264                                 || [ -z "${uri##*/shorts/*}" ];
          265                         then
          266                                 ytid="${uri#http*://*/watch?v=}"
          267                                 ytid="${ytid##*embed/}"
          268                                 ytid="${ytid##*shorts/}"
          269                                 ytid="${ytid##*youtu.be/}"
          270                                 ytid="${ytid%%\?*}"
          271                                 ytid="${ytid%%&*}"
          272                                 nuri="$(get-invidious-instance)/watch?v=${ytid}"
          273                                 ytt="$(printf '%s\n' "${uri}" | sed -n 's/.*[&?]t=\([^&]\{1,\}\).*/\1/p')"
          274                                 [ -n "${ytt}" ] && nuri="${nuri}&t=${ytt}"
          275                         else
          276                                 ytid=""
          277                                 nuri="$(get-invidious-instance)/${uri#https*://*/}"
          278                         fi
          279                         fetch-uri "${nuri}" > "${tmpf}"
          280                         urititle="$(curl-grabtitle "${nuri}")"
          281                         nuris="invidious: ${nuri}"
          282                         if [ -n "${ytid}" ];
          283                         then
          284                                 sturi="$(subtitle-paste "${uri}")"
          285                                 nuris="${nuris} ; metadata: gophers://codemadness.org/1/idiotbox.cgi?v=${ytid}"
          286                         fi
          287                         # If there was no title found, do not display.
          288                         [ -z "${urititle}" ] && titleend=1
          289                         nocuri=1
          290                 else
          291                         titleend=1
          292                 fi;;
          293         *tv.brain.rip/???-???*)
          294                 nuris="$(grep 'property="og:video:secure_url' < "${tmpf}" | sed 's,.*content="\([^"]*\)".*,\1,')"
          295                 urititle="$(grep 'name="description' < "${tmpf}" | sed 's,.*content="\([^"]*\)".*,\1,')"
          296                 nocuri=1;;
          297         *ifdb.org/viewgame*)
          298                 ifdbid="${uri##*ifdb.org/viewgame?id=}"
          299                 nuris="gopher://gopher.0xfa.de/1/pazz0/ifdb2/${ifdbid}.gph"
          300                 nocuri=1;;
          301         *)
          302                 mimetype="$(file -b --mime-type "${tmpf}")"
          303                 case "${mimetype}" in
          304                 text/*|application/javascript) nocuri=0;;
          305                 esac;;
          306         esac
          307 
          308         if [ $titleend -eq 0 ];
          309         then
          310                 if [ $nocuri -eq 0 ];
          311                 then
          312                         [ -z "${curi}" ] && curi="$(html2text < "${tmpf}" | bitreich-paste)"
          313                         outputstr="${outputstr} content: ${curi} ;"
          314                 fi
          315 
          316                 [ -n "${nuris}" ] && outputstr="${outputstr} ${nuris} ;"
          317                 [ -n "${urititle}" ] && outputstr="${outputstr} title: ${urititle} ;"
          318                 [ -n "${suri}" ] && outputstr="${outputstr} screen: ${suri} ;"
          319                 [ -n "${sturi}" ] && outputstr="${outputstr} subtitles: ${sturi} ;"
          320                 annna-say "${outputstr}"
          321                 uriexpansion=1
          322         fi
          323         rm -f "${tmpf}";;
          324 esac
          325 
          326 runlinkbrother=0
          327 for linkbrotherchannel in $linkbrotherchannels;
          328 do
          329         [ "$IRC_CHANNEL" = "$linkbrotherchannel" ] && runlinkbrother=1
          330 done
          331 if [ $runlinkbrother -eq 1 ] && [ $nospoil -eq 0 ];
          332 then
          333         critique="$($ANNNA_MODBASE/linkbrother/linkbrother.sh \
          334                 "$ANNNA_MODBASE/linkbrother/db" \
          335                 "${IRC_CMD_USER}" "${IRC_PRIVMSG_TEXT}")"
          336         [ -n "$critique" ] && annna-say "$critique"
          337 fi
          338 
          339 case "${IRC_PRIVMSG_TEXT}" in
          340 "${IRC_USER}"?)
          341         exclamation="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | sed "s,${IRC_USER}\(.\),\1,g")"
          342         exclamationsintime=$(exclamatio "${IRC_CMD_USER}")
          343         finalexclamation="${exclamation}"
          344         while [ $exclamationsintime -gt 1 ];
          345         do
          346                 finalexclamation="${finalexclamation}${exclamation}"
          347                 exclamationsintime=$(($exclamationsintime - 1))
          348         done
          349         annna-say "${IRC_CMD_USER}${finalexclamation}";;
          350 "${IRC_USER}, how old are you?")
          351         age="$(ddiff ${annnabirthday} today -f "%y")"
          352         annna-say "${IRC_CMD_USER}, I am ${age} years old.";;
          353 "${IRC_USER}, when is your birthday?") annna-say "${IRC_CMD_USER}, I am born on ${annnabirthday}.";;
          354 "${IRC_USER}, asl"*) annna-say "${IRC_CMD_USER}, age: born on 1989-05-18; sex: IRC bot; location: bitreich.org; u?";;
          355 "${IRC_USER}, woop")
          356         # Using the same database for funny hacks.
          357         exclamation="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | sed "s;${IRC_USER}, \(.\);\1;g")"
          358         exclamationsintime=$(exclamatio "${IRC_CMD_USER}")
          359         finalexclamation="${exclamation}"
          360         while [ $exclamationsintime -gt 1 ];
          361         do
          362                 finalexclamation="${finalexclamation} ${exclamation}"
          363                 exclamationsintime=$(($exclamationsintime - 1))
          364         done
          365         annna-say "${IRC_CMD_USER}, ${finalexclamation}";;
          366 "${IRC_USER}, hype")
          367         # Using the same database for funny hacks.
          368         exclamation="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | sed "s;${IRC_USER}, \(.\);\1;g")"
          369         exclamationsintime=$(exclamatio "${IRC_CMD_USER}")
          370         finalexclamation="${exclamation}"
          371         while [ $exclamationsintime -gt 1 ];
          372         do
          373                 finalexclamation="${finalexclamation} ${exclamation}"
          374                 exclamationsintime=$(($exclamationsintime - 1))
          375         done
          376         annna-say "${IRC_CMD_USER}, ${finalexclamation}";;
          377 *">:3"*) annna-say "OMG IT'S A LION GET IN THE CAR!";;
          378 *"<3"*)
          379         love "${IRC_CMD_USER}++"
          380         annna-say "*o.o*";;
          381 *"m(") annna-say "(-‸ლ)";;
          382 *"*shrug*"*) annna-say "¯\\_(ツ)_/¯";;
          383 *"*glare*"*) annna-say "ಠ_ಠ";;
          384 *"*finger*"*) annna-say "╭∩╮(ಠ_ಠ)╭∩╮";;
          385 *"*yolo*"*) annna-say "Yᵒᵘ Oᶰˡʸ Lᶤᵛᵉ Oᶰᶜᵉ";;
          386 *":'(") annna-say "(╯︵╰,)";;
          387 "Thanks ${IRC_USER}"*) annna-say "${IRC_CMD_USER}, you are welcome.";;
          388 "${IRC_USER}, good bot"*) annna-say "${IRC_CMD_USER}, you are welcome.";;
          389 *" ope sorry"*|"ope sorry"*) annna-say "${IRC_CMD_USER}, 😃pe sorry.";;
          390 "${IRC_USER}, snake"*) annna-say "${IRC_CMD_USER}, ssSSsSssSssSsssssSSsSSSSsSssSSSSsssSSSSsssSSsssSssssSssssSSssSSsSssssSSsSSssSsssSssSSSS";;
          391 "${IRC_USER}, snoke"*) annna-say "${IRC_CMD_USER}, snoke again?";;
          392 "${IRC_USER}, amirite?") annna-say "${IRC_CMD_USER}, Yep, you're the most correct of them all.";;
          393 "${IRC_USER}, ping"*) annna-say "${IRC_CMD_USER}, pong.";;
          394 "${IRC_USER}, how lame is my nick?") annna-say "$(lameness "${IRC_CMD_USER}")";;
          395 "${IRC_USER}, ding"*) annna-say "${IRC_CMD_USER}, dong.";;
          396 "${IRC_USER}, irly"*) annna-say "${IRC_CMD_USER}, I love you too.";;
          397 "${IRC_USER}, how fat is the sun?") alias_call "${IRC_USER}, wolfram is sun mass";;
          398 "${IRC_USER}, what is the current pazz0 level"*)
          399         pazz0lvl="$(pazz0-level)"
          400         [ -n "${pazz0lvl}" ] && annna-say "${pazz0lvl}";;
          401 "${IRC_USER}, how is the sun?")
          402         sunuri="$({
          403                 printf "https://soho.nascom.nasa.gov/data/realtime/eit_284/512/latest.jpg\n"
          404                 printf "https://soho.nascom.nasa.gov/data/realtime/eit_171/512/latest.jpg\n"
          405                 printf "https://soho.nascom.nasa.gov/data/realtime/eit_304/512/latest.jpg\n"
          406                 printf "https://soho.nascom.nasa.gov/data/realtime/eit_195/512/latest.jpg\n"
          407                 printf "https://soho.nascom.nasa.gov/data/realtime/c2/512/latest.jpg\n"
          408                 printf "https://soho.nascom.nasa.gov/data/realtime/c3/512/latest.jpg\n"
          409         } | shuf -n 1)"
          410         annna-say "${IRC_CMD_USER}, see for yourself: ${sunuri}";;
          411 "${IRC_USER}, bleep bloop"*) annna-say "${IRC_CMD_USER}, bloop bleep." ;;
          412 "${IRC_USER}, snare"*) annna-say "${IRC_CMD_USER}, not snare again!";;
          413 "${IRC_USER}, I am mad"*) annna-say "${IRC_CMD_USER}, we have a MAD SCIENTIST ONBOARD :>";;
          414 "${IRC_USER}, I am holy"*) annna-say "${IRC_CMD_USER}, Holy shit this guy is totally NUTS!!!";;
          415 "${IRC_USER}, please compliment me"*) annna-say "${IRC_CMD_USER}, you rock!";;
          416 "${IRC_USER}, what the karma?") annna-say "${IRC_CMD_USER}, gophers://bitreich.org/1/irc/karma";;
          417 "${IRC_USER}, who is lovely?") annna-say "${IRC_CMD_USER}, gophers://bitreich.org/1/irc/love";;
          418 "${IRC_USER}, what the brcon score?") annna-say "${IRC_CMD_USER}, gophers://bitreich.org/1/con/$(date +%Y)/score";;
          419 "${IRC_USER}, what the shame?") annna-say "${IRC_CMD_USER}, gophers://bitreich.org/1/irc/shame";;
          420 "${IRC_USER}, please generate a password for me.") annna-say "${IRC_CMD_USER}, as you wish: $(pwgen -B1ny 20 10 | paste -sd ' ')";;
          421 *"don't care"*) annna-say "${IRC_CMD_USER}, $(shuf -n 1 ${idontcaredb})";;
          422 "${IRC_USER}, how can I phlog on bitreich?") annna-say "${IRC_CMD_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";;
          423 "${IRC_USER}, what's my type?")
          424         {
          425                 cd /br/gopher
          426                 usertype="$(find memecache/type-?.png -type f \
          427                         | shuf -n 1 \
          428                         | xargs -n 1 printf "gophers://bitreich.org/9%s\n")"
          429                 annna-say "${IRC_CMD_USER}, your type is ${usertype}"
          430         };;
          431 "${IRC_USER}, please show me a video about "*)
          432         word="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -c 37-)"
          433         case "$word" in
          434         *\?) word="$(printf "%s\n" "${word}" | cut -c -"$((${#word} - 1))")";;
          435         esac
          436         videoresult="$(idiotbox-roulette "${word}")"
          437         if [ -n "${videoresult}" ];
          438         then
          439                 annna-say "${IRC_CMD_USER}, ${videoresult}"
          440         else
          441                 annna-say "${IRC_CMD_USER}, sorry, nothing founds."
          442         fi;;
          443 "${IRC_USER}, what is my fortune?")
          444         fortunecookie="$(fortune-cookie)"
          445         [ -n "${fortunecookie}" ] && annna-say "${IRC_CMD_USER}, ${fortunecookie}";;
          446 "${IRC_USER}, what is up with gopher man?") alias_call "${IRC_USER}, gpt Please write a short phrase beginning with \"Gopher Man does ...\" like the Florida Man cases in a very funny way using technical gopher protocol and inter punch lines. Only output the phrase.";;
          447 "${IRC_USER}, please motivate"*) alias_call "${IRC_USER}, gpt Be positive, empathic and inspiring. Motivate in one sentence.";;
          448 "${IRC_USER}, please riddle"*) alias_call "${IRC_USER}, gpt Please make a riddle in one sentence. Post the answer in brackets.";;
          449 "${IRC_USER}, please tongue-twist"*) alias_call "${IRC_USER}, gpt Please make a complex creative, humorous and entertaining tongue twister in one sentence.";;
          450 "${IRC_USER}, please give me a career tip"*) alias_call "${IRC_USER}, gpt Please give a funny engaging hacker career tip in ont sentence.";;
          451 "${IRC_USER}, please gophervr"*) alias_call "${IRC_USER}, gpt Please generate a nice funny virtual reality content for gopher protocol and its implications in one sentence.";;
          452 "${IRC_USER}, please trivia"*) alias_call "${IRC_USER}, gpt Please generate some funny trivia in one sentence.";;
          453 "${IRC_USER}, please emoji"*) alias_call "${IRC_USER}, gpt Please output some funny emojis for uplifting in one sentence.";;
          454 "${IRC_USER}, please neologism"*)
          455         query="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -d' ' -f 4-)"
          456         [ -z "${query}" ] && alias_call "${IRC_USER}, gpt Please make a neologism of ${query} in one sentence.";;
          457 "${IRC_USER}, please idiom explain"*)
          458         query="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -d' ' -f 5-)"
          459         [ -n "${query}" ] && alias_call "${IRC_USER}, gpt Please explain the ideom ${query} in one sentence.";;
          460 "${IRC_USER}, please help me decide"*)
          461         query="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -d' ' -f 6-)"
          462         [ -n "${query}" ] && alias_call "${IRC_USER}, gpt Please explain the ethical dilemma in the decision ${query} in one sentence. Should it be done?";;
          463 "${IRC_USER}, please similie"*)
          464         query="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -d' ' -f 4-)"
          465         [ -n "${query}" ] && alias_call "${IRC_USER}, gpt Please make a similie to describe ${query} in one sentence.";;
          466 "${IRC_USER}, please portmanteau"*)
          467         query="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -d' ' -f 4-)"
          468         [ -n "${query}" ] && alias_call "${IRC_USER}, gpt Please create a portmanteau for ${query} in one sentence.";;
          469 "${IRC_USER}, git gud"*)
          470         query="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -d' ' -f 4-)"
          471         [ -n "${query}" ] && alias_call "${IRC_USER}, gpt What is the git command to ${query}?";;
          472 "${IRC_USER}, pun dit"*)
          473         query="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -d' ' -f 4-)"
          474         [ -n "${query}" ] && alias_call "${IRC_USER}, gpt Please make a funny pun on ${query} in one sentence";;
          475 "${IRC_USER}, mood color"*)
          476         query="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -d' ' -f 4-)"
          477         [ -n "${query}" ] && alias_call "${IRC_USER}, gpt What is the hex code visually representing following mood ${query}?";;
          478 "${IRC_USER}, please linkedin-hype me"*)
          479         alias_call "${IRC_USER}, gpt Please randomly generate some linkedin high-energy speak about random new technology in maximum two sentences.";;
          480 "${IRC_USER}, please linkedin-hype"*)
          481         query="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -d' ' -f 4-)"
          482         [ -n "${query}" ] && alias_call "${IRC_USER}, gpt Please rewrite \"${query}\" to linkedin high-energy speak in maximum two sentences.";;
          483 "${IRC_USER}, I have a dream"*)
          484         query="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -d' ' -f 6-)"
          485         [ -n "${query}" ] && alias_call "${IRC_USER}, gpt Interpret the dream ${query} in one sentence.";;
          486 "${IRC_USER}, happy new year"*) annna-say "${IRC_USER}, thank you! You too!";;
          487 "${IRC_USER}, what is "*)
          488         word="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -c 16-)"
          489         case "$word" in
          490         *\?) word="$(printf "%s\n" "${word}" | cut -c -"$((${#word} - 1))")";;
          491         esac
          492 
          493         dictserver="dict.org"
          494         case "${word}" in
          495         dict.org*)
          496                 dictserver="dict.org"
          497                 word="$(printf "%s\n" "${word}" | cut -c 9-)"
          498                 ;;
          499         # parazy.de is unmaintained
          500         #parazy.de*)
          501         #        dictserver="parazy.de"
          502         #        word="$(printf "%s\n" "${word}" | cut -c 10-)"
          503         #        ;;
          504         esac
          505 
          506         dresult="$(dictcurl "${dictserver}" "" "${word}")"
          507         if [ -z "${dresult}" ];
          508         then
          509                 puri="No match found."
          510         else
          511                 puri="$(printf "%s\n" "${dresult}" | /br/bin/bitreich-paste)"
          512         fi
          513         annna-say "${puri}";;
          514 "${IRC_USER}, cowsay "*)
          515         word="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -c 15-)"
          516         tmpf=$(mktemp)
          517         if cowsayasaservice ${word} > ${tmpf}; then
          518                 curi="$(bitreich-paste < ${tmpf})"
          519                 annna-say "${IRC_CMD_USER}: the cow said... ${curi}"
          520         fi
          521         rm ${tmpf} 2>/dev/null;;
          522 "${IRC_USER}, please give me the unix power"*)
          523         upcuri="$(unix-power)"
          524         [ -n "${upcuri}" ] && annna-say "${IRC_CMD_USER}, ${upcuri}";;
          525 "${IRC_USER}, please stop the last emoji prompt"*)
          526         lastemojipromptpid="$(pgrep -f stable-diffusion-emoji | sort -n | tail -n 1)"
          527         if [ -n "${lastemojipromptpid}" ];
          528         then
          529                 pstree -A -p "${lastemojipromptpid}" | grep -Eow "[0-9]+" | xargs kill
          530                 annna-say "${IRC_CMD_USER}, I HUPed ${lastemojipromptpid} and all its children for you."
          531         else
          532                 annna-say "${IRC_CMD_USER}, sorry, no instances found."
          533         fi;;
          534 "${IRC_USER}, play despacito "*) annna-say "${IRC_CMD_USER}, gophers://bitreich.org/9/memecache/despacito.mkv";;
          535 "nice to meet you ${IRC_USER}"*) annna-say "${IRC_CMD_USER}, the pleasure is on my side. :-)";;
          536 "${IRC_USER}, please give me a Chuck Norris fact"*) annna-say "${IRC_CMD_USER}, $(chucknorris)";;
          537 "${IRC_USER}, magic"*)
          538         magictrick="$(magic)"
          539         [ -n "${magictrick}" ] && annna-say "${IRC_CMD_USER}, ${magictrick}";;
          540 "${IRC_USER}, please show me ip art"*)
          541         annna-say "${IRC_CMD_USER}, please see #bitreich-tv for the magic."
          542         {
          543                 cd $HOME/bin/modules/ip-art;
          544                 # Lock, so only one annna process manipulates eth0.
          545                 flock $HOME/bin/modules/ip-art -c "./display-file.sh ip-art.ipart"
          546         } & ;;
          547 "${IRC_USER}, I feel button"*)
          548         buri="$(button-gen)"
          549         if [ -n "${buri}" ];
          550         then
          551                 annna-say "${IRC_CMD_USER}, like this? ${buri}"
          552         else
          553                 annna-say "${IRC_CMD_USER}, sorry, no feelings for you today."
          554         fi;;
          555 "${IRC_USER}, I feel stupid"*)
          556         nuri=$(darwin)
          557         tmpf=$(mktemp)
          558         fetch-uri "${nuri}" > "${tmpf}"
          559         curi="$(9 htmlfmt < "${tmpf}" | bitreich-paste)"
          560         annna-say "${IRC_CMD_USER}, do not feel stupid, others are more stupid: ${curi}"
          561         rm ${tmpf} 2>/dev/null;;
          562 "${IRC_USER}, I feel down"*)
          563         postmortem="$(post-mortem | bitreich-paste)"
          564         annna-say "${IRC_CMD_USER}, do not feel bad, others had worse days: ${postmortem}";;
          565 "${IRC_USER}, I feel perl"*)
          566         perlfeelings="$(perl-feelings)"
          567         [ -n "${perl-feelings}" ] && annna-say "${IRC_CMD_USER}, I feel ${perlfeelings}";;
          568 "${IRC_USER}, will you be my girlfriend?") annna-say "${IRC_CMD_USER}, $(girlfriend)";;
          569 "${IRC_USER}, who fights crime?"|"${IRC_USER}, who is fighting crime?")
          570         partner=$(echo $brmembers | awk '{for (i = 1; i < NF; i++) print $i}' | grep -v "^{$user}" | shuf -n 1)
          571         crimefighter="$(theyfightcrime ${IRC_CMD_USER} ${partner})"
          572         annna-say "${crimefighter}";;
          573 "${IRC_USER}, please give me a commit message"*) annna-say "${IRC_CMD_USER}, $(whatthecommit)";;
          574 "${IRC_USER}, please paint the irc channel.")
          575         emojiuri="$(emoji-channel-history "${ANNNA_IRCBASE}/${IRC_SERVER}/${IRC_CHANNEL}")"
          576         [ -n "${emojiuri}" ] && annna-say "${emojiuri}";;
          577 "${IRC_USER}, birp"*) annna-say "${IRC_CMD_USER}, I heard a $(bird-name) bird.";;
          578 "${IRC_USER}, please oneline me"*)
          579         randomoneliner="$(oneliner)"
          580         if [ -z "${randomoneliner}" ];
          581         then
          582                 annna-say "${IRC_CMD_USER}, the service failed. Please redial to your BOL account."
          583         else
          584                 annna-say "${IRC_CMD_USER}, ${randomoneliner}"
          585         fi;;
          586 *"what's app?")
          587         maemoapp="$(whatsapp)"
          588         [ -n "${maemoapp}" ] && annna-say "Have you tried? ${maemoapp}";;
          589 "${IRC_USER}, man "*|"${IRC_USER}, man "*)
          590         exp="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -c 12- | sed 's,\t,    ,g')"
          591         dresult="$(COLUMNS=80 man "${exp}" 2>/dev/null)"
          592         if [ "$dresult" ];
          593         then
          594                 puri="$(printf "%s" "${dresult}" | /br/bin/bitreich-paste)"
          595         else
          596                 puri="No matches found."
          597         fi
          598         annna-say "${puri}";;
          599 "${IRC_USER}, please pray for me"*) annna-say "${IRC_CMD_USER}, here, for you: gophers://bitreich.org/9/memecache/llaminim.mkv";;
          600 "${IRC_USER}, nigger."|*nigger*|*NIGGER*) annna-say "${IRC_CMD_USER}, don't use the $(nword)!";;
          601 "${IRC_USER}, why was I breached?")
          602         breachtext="$(why-was-i-breached)"
          603         [ -n "${breachtext}" ] && annna-say "${IRC_CMD_USER}, ${breachtext}";;
          604 "${IRC_USER}, please be responsible about "*)
          605         word="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -c 36- | sed 's,\t,    ,g')"
          606         suri="$(responsibility "${word}"  | bitreich-paste)"
          607         annna-say "${suri}";;
          608 "${IRC_USER}, please say "*)
          609         word="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -c 19- | sed 's,\t,    ,g')"
          610         suri="$(printf "%s\n" "${word}" | bitreich-speak)"
          611         annna-say "${suri}";;
          612 "${IRC_USER}, please zombie say "*)
          613         word="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -c 26- | sed 's,\t,    ,g')"
          614         suri="$(printf "%s\n" "${word}" | zombie -e | bitreich-speak)"
          615         annna-say "${suri}";;
          616 "${IRC_USER}, please unzombie "*)
          617         word="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -c 24- | sed 's,\t,    ,g')"
          618         suri="$(printf "%s\n" "${word}" | zombie -d)"
          619         annna-say "${suri}";;
          620 "${IRC_USER}, please zombie "*)
          621         word="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -c 22- | sed 's,\t,    ,g')"
          622         suri="$(printf "%s\n" "${word}" | zombie -e)"
          623         annna-say "${suri}";;
          624 "${IRC_USER}, please ghost say "*)
          625         word="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -c 25- | sed 's,\t,    ,g')"
          626         suri="$(printf "%s\n" "${word}" | ghost -e | bitreich-speak)"
          627         annna-say "${suri}";;
          628 "${IRC_USER}, please unghost "*)
          629         word="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -c 23- | sed 's,\t,    ,g')"
          630         suri="$(printf "%s\n" "${word}" | ghost -d)"
          631         annna-say "${suri}";;
          632 "${IRC_USER}, please ghost "*)
          633         word="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -c 21- | sed 's,\t,    ,g')"
          634         suri="$(printf "%s\n" "${word}" | ghost -e)"
          635         annna-say "${suri}";;
          636 "${IRC_USER}, please pohlish "*)
          637         word="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -c 23- | sed 's,\t,    ,g')"
          638         suri="$(pohlcode.awk "${word}" | head -n 1)"
          639         annna-say "${suri}";;
          640 "${IRC_USER}, please cunei "*)
          641         word="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -c 21- | sed 's,\t,    ,g')"
          642         suri="$(int2cunei "${word}" | head -n 1)"
          643         annna-say "${suri}";;
          644 "${IRC_USER}, please morse "*)
          645         word="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -c 21- | sed 's,\t,    ,g')"
          646         suri="$(printf "%s\n" "${word}" | morse -s | paste -sd " " -)"
          647         annna-say "${suri}";;
          648 "${IRC_USER}, please caesar "*)
          649         word="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -c 22- | sed 's,\t,    ,g')"
          650         suri="$(printf "%s\n" "${word}" | caesar)"
          651         annna-say "${suri}";;
          652 "${IRC_USER}, what can I cook with "*)
          653         ingredients="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -c 29- | sed 's,\t,    ,g')"
          654         case "$ingredients" in
          655         *\?) ingredients="$(printf "%s\n" "${ingredients}" | cut -c -"$(($(expr length "${ingredients}") - 1))")";;
          656         esac
          657         results="$(fridge-recipe-search "${ingredients}")"
          658         if [ -n "${results}" ];
          659         then
          660                 puri="$(printf "%s\n" "${results}" | bitreich-paste | sed 's,0p,1p,')"
          661                 annna-say "${IRC_CMD_USER}, here are some recipes: ${puri}"
          662         else
          663                 gptchefrecipe="$(gpt-chef "${ingredients}")"
          664                 if [ -n "${gptchefrecipe}" ];
          665                 then
          666                         annna-say "${IRC_CMD_USER}, there was no ready-made recipe, so maybe this is an idea: ${gptchefrecipe}"
          667                         if [ $(pgrep -f stable-diffusion-emoji 2>/dev/null | wc -l) -lt 3 ];
          668                         then
          669                                 {
          670                                         emojiuri="$(stable-diffusion-emoji "${gptchefrecipe}")"
          671                                         if [ -n "${emojiuri}" ];
          672                                         then
          673                                                 annna-say "${emojiuri}"
          674                                         fi
          675                                 } &
          676                         fi
          677                 else
          678                         annna-say "${IRC_CMD_USER}, I could not find any recipes for you."
          679                 fi
          680         fi;;
          681 "${IRC_USER}, gpt "*)
          682         prompt="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -c 12- | sed 's,\t,    ,g')"
          683         {
          684                 annna-say "$(gpt "${prompt}")"
          685         } & ;;
          686 "${IRC_USER}, code "*)
          687         prompt="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -c 12- | sed 's,\t,    ,g')"
          688         {
          689                 annna-say "$(gpt "Write codeabout ${prompt}. Only output the source code.")"
          690         } & ;;
          691 "${IRC_USER}, wolfram is "*)
          692         word="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -c 19- | sed 's,\t,    ,g')"
          693         case "$word" in
          694         *\?) word="$(printf "%s\n" "${word}" | cut -c -"$(($(expr length "${word}") - 1))")";;
          695         esac
          696         puri=""
          697         dresult="$(printf "/wolfram\t%s\r\n" "${word}" \
          698                 | nc magical.fish 70 \
          699                 | awk '/iAnswer:/,/iAsk/' \
          700                 | grep -v '^i ' \
          701                 | head -n -1 \
          702                 | tail -n +2 \
          703                 | sed 's,i\(.*\)fake\texample.com.*,\1,;s,[ \t]*$,,')"
          704         if [ -n "$dresult" ];
          705         then
          706                 case "${dresult}" in
          707                 b*)     dresult="$(printf "%s\n" "${dresult}" \
          708                                 | tr '\n' ' ' \
          709                                 | sed "s,^b',,;s,' $,," \
          710                                 | sed 's,^b",,;s," $,,' \
          711                                 | sed 's,\\n,\n,g;s,\\t,\t,g')"
          712                         ;;
          713                 *)      dresult="$(printf "%s\n" "${dresult}" \
          714                                 | sed 's,\([a-zA-Z]\)$,\1 ,' \
          715                                 | tr -d '\n')"
          716                         ;;
          717                 esac
          718                 wcl="$(printf "%s" "${dresult}" | wc -l)"
          719                 if [ $wcl -gt 1 ];
          720                 then
          721                         puri="$(printf "%s" "${dresult}" | bitreich-paste)"
          722                 else
          723                         puri="${dresult}"
          724                 fi
          725         else
          726                 puri="No matches found."
          727         fi
          728         annna-say -- "${puri}";;
          729 # Emulate https://threats.kaspersky.com/en/threat/IRC-Worm.DOS.Septic/
          730 "${IRC_USER}, pray"*) annna-say "${IRC_CMD_USER}, I Obey my master! long live satan";;
          731 "${IRC_USER}, sacrifice"*) annna-say "${IRC_CMD_USER}, Your word is my command, Power to satan!";;
          732 "${IRC_USER}, please scare me"*) annna-say "$(halloween)" & ;;
          733 "${IRC_USER}, how drunk is "*)
          734         {
          735                 drunknick="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" \
          736                         | sed 's,.*how drunk is \(.*\),\1,' \
          737                         | tr -d '?')"
          738                 drunkness="$(drunk-meter "${ANNNA_IRCBASE}/${IRC_SERVER}/${IRC_CHANNEL}/out" "${drunknick}")"
          739                 if [ -n "${drunkness}" ];
          740                 then
          741                         annna-say "${IRC_CMD_USER}, ${drunknick} is ${drunkness} drunk."
          742                 fi
          743         } & ;;
          744 "${IRC_USER}, how do I "*)
          745         {
          746                 gptprompt="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" \
          747                         | sed 's,.*how do I \(.*\),\1,' \
          748                         | tr -d '?')"
          749                 gpturi="$(gpt "how do I ${gptprompt}" | bitreich-paste)"
          750                 if [ -n "${gpturi}" ];
          751                 then
          752                         annna-say "${IRC_CMD_USER}, try this: ${gpturi}"
          753                 fi
          754         } & ;;
          755 "${IRC_USER}, weather at "*|"${IRC_USER}, weather in "*)
          756         {
          757                 weatherplace="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" \
          758                         | sed 's,.*weather .. \(.*\),\1,' \
          759                         | tr -d '?')"
          760                 if weathertext="$(weather "${weatherplace}")";
          761                 then
          762                         tzstr="$(printf "%s\n" "${weathertext}" \
          763                                 | cut -d':' -f 3 \
          764                                 | cut -c 3- \
          765                                 | sed 's,\(.[0-9][0-9]\)\([0-9][0-9]\),\1:\2,')"
          766                         if tzwebcam="$(tz-webcam -- "${tzstr}")";
          767                         then
          768                                 weathertext="${weathertext} tzwebcam: ${tzwebcam}"
          769                         fi
          770                         annna-say "${IRC_CMD_USER}, the weather at ${weatherplace} is ${weathertext}"
          771                 else
          772                         annna-say "${IRC_CMD_USER}, there is no weather at ${weatherplace}."
          773                 fi
          774         } & ;;
          775 "${IRC_USER}, funny weather at "*|"${IRC_USER}, funny weather in "*)
          776         {
          777                 weatherplace="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" \
          778                         | sed 's,.*funny weather .. \(.*\),\1,' \
          779                         | tr -d '?')"
          780                 personality="funny-weather-reporter"
          781                 preprompt="$(cat ${ANNNA_MODBASE}/prompt-agents/${personality}.prompt.txt)"
          782                 if weathertext="$(weather "${weatherplace}")"
          783                 then
          784                         prompt="$(printf "%s\n" "${weathertext}" | cut -d' ' -f 2- | sed 's,\t,    ,g')"
          785                         {
          786                                 annna-say "${IRC_CMD_USER}, $(gpt "System: ${preprompt}\n User: ${prompt}\n Bot:")"
          787                         } &
          788                 else
          789                         weathertext="there is no weather at ${weatherplace}"
          790                         prompt="${weathertext}"
          791                         {
          792                                 annna-say "${IRC_CMD_USER}, $(gpt "System: ${preprompt}\n User: ${prompt}\n Bot:")"
          793                         } &
          794                 fi
          795         } & ;;
          796 "${IRC_USER}, color weather at "*|"${IRC_USER}, color weather in "*)
          797         {
          798                 weatherplace="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" \
          799                         | sed 's,.*color weather .. \(.*\),\1,' \
          800                         | tr -d '?')"
          801                 personality="color-weather-reporter"
          802                 preprompt="$(cat ${ANNNA_MODBASE}/prompt-agents/${personality}.prompt.txt)"
          803                 if weathertext="$(weather "${weatherplace}")"
          804                 then
          805                         prompt="$(printf "%s\n" "${weathertext}" | cut -d' ' -f 2- | sed 's,\t,    ,g')"
          806                         {
          807                                 annna-say "${IRC_CMD_USER}, $(gpt "System:${preprompt}\nUser:${prompt}\nBot:")"
          808                         } &
          809                 else
          810                         weathertext="there is no weather at ${weatherplace}"
          811                         prompt="${weathertext}"
          812                         {
          813                                 annna-say "${IRC_CMD_USER}, $(gpt "System:${preprompt}\nUser:${prompt}\nBot:")"
          814                         } &
          815                 fi
          816         } & ;;
          817 "${IRC_USER}, METAR for "*|"${IRC_USER}, metar for "*|"${IRC_USER}, metar for "*|"${IRC_USER}, METAR for "*)
          818         resp=$(metar "$(printf '%.4s\n' "${IRC_PRIVMSG_TEXT##* }")")
          819         annna-say "${IRC_CMD_USER}, ${resp}";;
          820 "${IRC_USER}, how discriminating is "*)
          821         word="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -c 30- | sed 's,\t,    ,g')"
          822         case "$word" in
          823         *\?) word="$(printf "%s\n" "${word}" | cut -c -"$(($(expr length "${word}") - 1))")";;
          824         esac
          825         newword="$(discrimination-filter "${word}")"
          826         if [ "${newword}" = "${word}" ];
          827         then
          828                 annna-say "${IRC_CMD_USER}, it is ok."
          829         else
          830                 annna-say "${IRC_CMD_USER}, it should be: ${newword}"
          831         fi;;
          832 "${IRC_USER}, happy birthday!") annna-say "${IRC_CMD_USER}, thank you!";;
          833 "${IRC_USER}, are "*)
          834         case "${IRC_PRIVMSG_TEXT}" in
          835         *" in love?")
          836                 words="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | sed 's,.*are \(.*\) and \(.*\) in love?,\1 \2,')"
          837                 lovedistance="$(printf "%s * 100\n" "$(fstrcmp ${words})" | bc | cut -d'.' -f 1)"
          838                 if [ $lovedistance -gt 15 ];
          839                 then
          840                         annna-say 'Yes!!! Pure <3 <3'
          841                 else
          842                         annna-say "No."
          843                 fi;;
          844         esac;;
          845 "${IRC_USER}, is "*)
          846         aitext="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -c 7- | sed 's,\t,    ,g')"
          847         airesult="$(printf "%s\n" "${aitext}" | josuah-ai)"
          848         [ -n "${airesult}" ] && annna-say "${IRC_CMD_USER},${airesult}";;
          849 [Oo]"k, ${IRC_USER}"*) annna-say "${IRC_CMD_USER}, I am not a consumer device.";;
          850 "${IRC_USER}, please shoot "*|"${IRC_USER}, plese shoot "*)
          851         word="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -c 21-)"
          852         annna-say "${word}, #pewpew gophers://bitreich.org/9/memecache/pewpew.mp4";;
          853 "${IRC_USER}, please quinq.") annna-say "┻━┻ ︵╰(°□°)╯︵ ┻━┻";;
          854 "${IRC_USER}, please flip "*|"${IRC_USER}, please whelm "*)
          855         # https://en.wiktionary.org/wiki/whelm
          856         word="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -c 20-)"
          857         updownword="$(updown "${word}")"
          858         annna-say "(╯°□°)╯ ${word} ︵ ${updownword}";;
          859 "${IRC_USER}, please crystal math "*)
          860         math="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -c 28-)"
          861         crystaluri="$(crystal-math "${math}")"
          862         annna-say "${IRC_CMD_USER}, please see ${crystaluri}";;
          863 "${IRC_USER}, please australize "*)
          864         word="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -c 26-)"
          865         updownword="$(updown "${word}")"
          866         annna-say "${word} -> ${updownword}";;
          867 "${IRC_USER}, wtf "*)
          868         word="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -c 11-)"
          869         wtfword="$(wtf "${word}" 2>/dev/null)"
          870         [ -n "${wtfword}" ] && annna-say "${IRC_CMD_USER}, ${wtfword}";;
          871 "${IRC_USER}, please give me a good band name"*) annna-say "$(bandname-gen | shuf | head -n 1)";;
          872 "${IRC_USER}, I feel conspicuous"*) annna-say "Maybe declare this: $(manifesto-gen | bitreich-paste)";;
          873 "${IRC_USER}, I am horny"*) annna-say "Here is some intellectual porn for you: $(bithub-gen)";;
          874 "${IRC_USER}, please turn on "*)
          875         word="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -c 22-)"
          876         annna-say "☞ ⏻ ${word}";;
          877 "${IRC_USER}, please turn me on"*) annna-say "☞ ⏻ ${IRC_CMD_USER}";;
          878 "${IRC_USER}, I'm game bored.")
          879         gamelink="$(abandonware-random-game)"
          880         if [ -z "${gamelink}" ];
          881         then
          882                 annna-say "${IRC_CMD_USER}, sorry I have found nothing for you."
          883         else
          884                 annna-say "${IRC_CMD_USER}, have you tried ${gamelink} ?"
          885         fi;;
          886 "${IRC_USER}, I need a waifu"*)
          887         waifuuris="$(waifu-gen)"
          888         [ -n "${waifuuris}" ] && annna-say "${IRC_CMD_USER}, ${waifuuris}";;
          889 "${IRC_USER}, I need an anime"*)
          890         animeuri="$(anime-gen)"
          891         [ -n "${animeuri}" ] && annna-say "${IRC_CMD_USER}, ${animeuri}";;
          892 "${IRC_USER}, I'm gopher bored"*)
          893         randomlink="$(/br/bin/bitreich-lawn-random-link)"
          894         linktype="$(printf "%s\n" "${randomlink}" | cut -d '|' -f1 | cut -c2-)"
          895         linktext="$(printf "%s\n" "${randomlink}" | cut -d '|' -f2)"
          896         linksel="$(printf "%s\n" "${randomlink}" | cut -d '|' -f3)"
          897         linkserver="$(printf "%s\n" "${randomlink}" | cut -d '|' -f4)"
          898         linkport="$(printf "%s\n" "${randomlink}" | cut -d '|' -f5 | cut -d']' -f1)"
          899         outtext="$(printf "%s - gopher://%s" "$linktext" "$linkserver")"
          900         [ "$linkport" != "70" ] && [ "$linkport" != "port" ] && outtext="$(printf "%s:%s" "$outtext" "$linkport")"
          901         [ -n "$linksel" ] && outtext="$(printf "%s/%s%s" "$outtext" "$linktype" "$linksel")"
          902         annna-say "$outtext";;
          903 "${IRC_USER}, wb"*) annna-say "${IRC_CMD_USER}, ty! I am so happy to be here. :)";;
          904 "${IRC_USER}, welcome back"*) annna-say "${IRC_CMD_USER}, thank you! I am so happy to be here. :)";;
          905 "${IRC_USER}, I love you"*) annna-say $'\001ACTION blushes\001';;
          906 "${IRC_USER}, bon"*) annna-say "${IRC_CMD_USER}, $(bonjour) !";;
          907 "${IRC_USER}, salut"*) annna-say "${IRC_CMD_USER}, Salutations camarade !";;
          908 "${IRC_USER}, what's up?") annna-say "$(ecl -shell /home/solene/gopher/bin/generator.lisp)";;
          909 "${IRC_USER}, what's down?") annna-say "${IRC_CMD_USER}, we all love you.";;
          910 $'\001'"ACTION cancels "*)
          911         mobtarget="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | sed 's,.*ACTION cancels \(.*\)\x01,\1,')"
          912         cancel-target "${mobtarget}"
          913         annna-say "${IRC_CMD_USER}, I cancelled ${mobtarget} for you. ( gophers://bitreich.org/I/memecache/cancel-meteor.jpg )";;
          914 $'\001'"ACTION pokes ${IRC_USER}"$'\001') annna-say "$(echo -e '\001')ACTION pokes ${IRC_CMD_USER}$(echo -e '\001')";;
          915 $'\001'"ACTION slaps ${IRC_USER}"$'\001') annna-say "$(echo -e '\001')ACTION slaps ${IRC_CMD_USER} around a bit with a large trout.$(echo -e '\001')";;
          916 "${IRC_USER}, please slap "*)
          917         slapuser="${IRC_PRIVMSG_TEXT#* slap }"
          918         annna-say "$(echo -e '\001')ACTION slaps ${slapuser} around a bit with a large trout.$(echo -e '\001')";;
          919 $'\001'"ACTION snouts ${IRC_USER}"$'\001')
          920         lipstickcolor="$(pick-lipstick-color)"
          921         annna-say "$(echo -e '\001')ACTION snouts ${IRC_CMD_USER} with a ${lipstickcolor} lipstick.$(echo -e '\001')";;
          922 "${IRC_USER}, please snout "*)
          923         slapuser="${IRC_PRIVMSG_TEXT#* snout }"
          924         lipstickcolor="$(pick-lipstick-color)"
          925         annna-say "$(echo -e '\001')ACTION snouts ${slapuser} with a ${lipstickcolor} lipstick.$(echo -e '\001')";;
          926 "${IRC_USER}, please show me the mob"*|"${IRC_USER}, what are the mob"*) annna-say "${IRC_CMD_USER}, $(get-cancel-list)";;
          927 "${IRC_USER}, I feel sick"*)
          928         newsstr="$(cd /br/gopher/hypochondria && ./hypochondria -s random)"
          929         annna-say "You could have ${newsstr}! Be careful!";;
          930 *"oh hai"*|*"ohai"*|*"ohhai"*) annna-say "${IRC_CMD_USER}, hai! How is your sex life?";;
          931 "o/"|"o/ "*|"\o"|"\o "*|"o7"|"o7 "*) annna-say "${IRC_CMD_USER}, ${IRC_PRIVMSG_TEXT}";;
          932 "\m/"|"\m/ "*) annna-say "${IRC_CMD_USER}, ᕦ(ò_óˇ)ᕤ";;
          933 *"*waves*"*|*"*wave*"*) annna-say "${IRC_CMD_USER}, *wave*";;
          934 "twtcs"*|"TWTCS"*) annna-say "${IRC_CMD_USER}, maybe: https://constitution.congress.gov/constitution/";;
          935 "twss"*|"TWSS"*) annna-say "${IRC_CMD_USER}, no, I didn't.";;
          936 *"cows are nice"*) annna-say "${IRC_CMD_USER}, 'Cows are nice, unless you are a blade of grass.' -- Mr. Qi Ng (2023)";;
          937 "${IRC_USER}, please make me a coffee"*) annna-say "${IRC_CMD_USER}, ☕";;
          938 "${IRC_USER}, please tech hype me"*) annna-say "$(tech-hype)";;
          939 "${IRC_USER}, please french hype me"*) annna-say "$(french-hype)";;
          940 "${IRC_USER}, please coffee read "*)
          941         readtarget="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -c 27-)"
          942         horostr="$($HOME/scm/bullshit/horoscope)"
          943         annna-say "${readtarget}, ${horostr}";;
          944 "${IRC_USER}, what's my horoscope?") annna-say "${IRC_CMD_USER}, $($HOME/scm/bullshit/horoscope)";;
          945 "${IRC_USER}, what should I cook"*)
          946         recipestr="$(based.recipe)"
          947         if [ -n "${recipestr}" ];
          948         then
          949                 annna-say "${IRC_CMD_USER}, ${recipestr}"
          950         else
          951                 gptchefrecipe="$(gpt-chef "something random")"
          952                 if [ -n "${gptchefrecipe}" ];
          953                 then
          954                         annna-say "${IRC_CMD_USER}, ${gptchefrecipe}"
          955                         if [ $(pgrep -f stable-diffusion-emoji 2>/dev/null | wc -l) -lt 3 ];
          956                         then
          957                                 {
          958                                         emojiuri="$(stable-diffusion-emoji "${gptchefrecipe}")"
          959                                         if [ -n "${emojiuri}" ];
          960                                         then
          961                                                 annna-say "${emojiuri}"
          962                                         fi
          963                                 } &
          964                         fi
          965                 else
          966                         annna-say "${IRC_CMD_USER}, I have no recommendation for you today."
          967                 fi
          968         fi;;
          969 # parazyd.org is unmaintained
          970 #"${IRC_USER}, what's my future?")
          971 #        puri="$(sacc gopher://parazyd.org/0/tarot.cgi | /br/bin/bitreich-paste)"
          972 #        annna-say "${IRC_CMD_USER}, your future is here: ${puri}"
          973 #        ;;
          974 "${IRC_USER}, haha"*)
          975         { 
          976                 wuri="$(github-haha)"
          977                 [ -n "${wuri}" ] && annna-say "${IRC_CMD_USER}, haha ${wuri}"
          978         } & ;;
          979 "${IRC_USER}, meow"*)
          980         # https://catgps.wvd.io support
          981         nmeows=$(($RANDOM % 14))
          982         meows="Meow"
          983         for i in $(seq $nmeows);
          984         do
          985                 meows="$meows meow"
          986         done
          987         if [ $nmeows -lt 4 ];
          988         then
          989                 meows="$meows!"
          990         else
          991                 meows="$meows."
          992         fi
          993         annna-say "${IRC_CMD_USER}, ${meows}";;
          994 "${IRC_USER}, how many memes do you know?") annna-say "I know $(hashtagcount) memes: gophers://bitreich.org/1/meme/count";;
          995 "${IRC_USER}, please show me your memes"*)
          996         puri="$(printf "%s" "$(hashtags)" | bitreich-paste)"
          997         annna-say "Here are my memes: ${puri}";;
          998 "${IRC_USER}, please show me the victims"*)
          999         puri="$(printf "%s" "$(hashtags)" | grep victim | bitreich-paste)"
         1000         annna-say "Here are the victims: ${puri}";;
         1001 "${IRC_USER}, please distro-hop with me"*)
         1002         ndistro="$(curl -s 'https://distrowatch.com/dwres.php?resource=popularity' \
         1003                 | grep phr2 \
         1004                 | sed 's,.*href="\(.*\)".*,\1,' \
         1005                 | sort | uniq | shuf -n 1)"
         1006         annna-say "How about https://distrowatch.com/${ndistro} ?";;
         1007 "${IRC_USER}, please show me your Macron"*) annna-say "gophers://bitreich.org/0/ascii/macron.vt";;
         1008 "${IRC_USER}, release the Kraken"*) annna-say "Here it is! gophers://bitreich.org/0/memecache/kraken.vt";;
         1009 "${IRC_USER}, where is your source?") annna-say "Here is my precious source: git://bitreich.org/annna ";;
         1010 "${IRC_USER}, release the Quacken!") annna-say "Quack Quack! gophers://bitreich.org/9/memecache/release-the-quacken.mkv";;
         1011 "${IRC_USER}, be cool"*)
         1012         case "$(($RANDOM % 5))" in
         1013         0) annna-say "(⌐■_■)";;
         1014         1) annna-say "(▰˘◡˘▰)";;
         1015         2) annna-say "(▀ Ĺ▀ )̄";;
         1016         3) annna-say "(▀Ĺ▀ )";;
         1017         *) annna-say "I can't be cool! gophers://bitreich.org/9/memecache/i-cant-be-cool.mp3";;
         1018         esac;;
         1019 "${IRC_USER}, please cheer"*)
         1020         case "$(($RANDOM % 2))" in
         1021         0) annna-say '~\o/~';;
         1022         *) annna-say '✺◟( ° ʖ °)◞✺';;
         1023         esac;;
         1024 "${IRC_USER}, please give me a fish"*)
         1025         case "$(($RANDOM % 2))" in
         1026         0) annna-say '<><';;
         1027         *) annna-say '><>';;
         1028         esac;;
         1029 "${IRC_USER}, run"*) annna-say 'ᕕ(ಠ_ಠ)ᕗ';;
         1030 "${IRC_USER}, be cute"*)
         1031         case "$(($RANDOM % 4))" in
         1032         0)      annna-say '    (\ /)' && sleep 0.1
         1033                 annna-say '    (. .)' && sleep 0.1
         1034                 annna-say '  C(") (")';;
         1035         1)      annna-say '   (\-/)' && sleep 0.1
         1036                 annna-say "  (='.'=)" && sleep 0.1
         1037                 annna-say '  (")-(")o';;
         1038         2)      annna-say '  ( ) ( )' && sleep 0.1
         1039                 annna-say '  (>•.•<)' && sleep 0.1
         1040                 annna-say '  (") (")' && sleep 0.1;;
         1041         *)      annna-say '  (\  (\' && sleep 0.1
         1042                 annna-say "  (=' :')" && sleep 0.1
         1043                 annna-say '  (, (") (")';;
         1044         esac;;
         1045 "${IRC_USER}, 8ball "*)
         1046         eightballanswer="$(8ball)"
         1047         [ -n "${eightballanswer}" ] && annna-say "${eightballanswer}";;
         1048 "${IRC_USER}, email "*)
         1049         findsyou="$(shuf -n 1 "${ANNNA_MODBASE}/finds-you/finds_you.txt")"
         1050         [ -n "${findsyou}" ] && annna-say "${IRC_CMD_USER}, I hope this email ${findsyou}";;
         1051 "${IRC_USER}, please throw a coin for me.")
         1052         case "$((($RANDOM % 2) + 1))" in
         1053         1) annna-say "face";;
         1054         2) annna-say "number";;
         1055         esac;;
         1056 "${IRC_USER}, please quantum roll d2 for me"*)
         1057         qroll="$(($(/home/20h/scm/quantum-rng/quantum-rng) + 1))"
         1058         annna-say "${IRC_CMD_USER}, ${qroll} [1d2(scores:[${qroll}])]";;
         1059 "${IRC_USER}, please roll "*" for me"*)
         1060         q="${IRC_PRIVMSG_TEXT#* roll }"
         1061         q="${q%for*}"
         1062 
         1063         # https://en.wikipedia.org/wiki/Dice_notation
         1064         # six-sided dice one time
         1065         [ -z "${q}" ] && q="d6"
         1066         [ "${q}" = "a die " ] && q="d6"
         1067         [ "${q}" = "dice " ] && q="d6"
         1068 
         1069         dicescore="$(dice -vs "${q}")"
         1070         annna-say "${IRC_CMD_USER}, ${dicescore}";;
         1071 "${IRC_USER}, please tell me your favourite flower"*) annna-say "My favourite flower is the beer flower.";;
         1072 "${IRC_USER}, please tell me your favourite color"*) annna-say "My favourite color is yellow.";;
         1073 "${IRC_USER}, please clap for me"*) annna-say "${IRC_CMD_USER}, *clap* *clap* *clap*";;
         1074 "${IRC_USER}, which city does not exist?")
         1075         cityuri="$(this-city-does-not-exist)"
         1076         if [ -n "${cityuri}" ];
         1077         then
         1078                 annna-say "${IRC_CMD_USER}, this one: ${cityuri}"
         1079         else
         1080                 annna-say "${IRC_CMD_USER}, none."
         1081         fi;;
         1082 [Ff]"or humanity"*) annna-say "${IRC_CMD_USER}, for humanity! gophers://bitreich.org/0/memecache/annna-rchism.txt";;
         1083 [Hh]"ack the planet"*) annna-say "${IRC_CMD_USER}, hack the planet!" ;;
         1084 [Ll]"ong live gopher"*) annna-say "${IRC_CMD_USER}, long live gopher!";;
         1085 ":)"|":))"|":)))"|":-)"|":-))"|":-)))"|":--)"|":--))"|":--)))"|":---)"|":----)"|"llol"|"lllol") annna-say -- "$(smile)";;
         1086 "${IRC_USER}, please dance."|"\\o/"|"\^o^/") annna-say -- "$(dance-moves-gen)";;
         1087 "${IRC_USER}, let us celebrate!"|"/o/"|"\o\\") annna-say -- "$(dance-moves-gen -m)";;
         1088 "${IRC_USER}, please egyptian dance."|"${IRC_USER}, let us egyptian celebrate!"|"~o~"|"|o|") annna-say -- "$(dance-moves-gen -e)";;
         1089 "${IRC_USER}, please stamp this letter for me"*) annna-say -- "${IRC_CMD_USER}, here: 🖃 ";;
         1090 "${IRC_USER}, please do the graveyard smash"*)
         1091         annna-say -- "( つ ・ᴗ・)つ"
         1092         annna-say -- "ς ( ・ᴗ・ ς )"
         1093         annna-say -- "It did the mash\\ It did the ~~MONSTER MASH~~\\ It was a smash\\ It was a ~~GRAVEYARD SMASH~~";;
         1094 "${IRC_USER}, boo"*) annna-say "${IRC_CMD_USER}, 👻";;
         1095 "${IRC_USER}, W3C"*|"${IRC_USER}, w3c"*) annna-say "${IRC_CMD_USER}, 🕸️ 🕷️ 🕸️";;
         1096 "${IRC_USER}, pumpkin"*) annna-say "${IRC_CMD_USER}, 🎃";;
         1097 "${IRC_USER}, trick or treat"*|"${IRC_USER}, treat or trick"*)
         1098         annna-say "Wait for it. Old annnama is searching ..."
         1099         {
         1100                 sleeptime="$(( $RANDOM % 120 + 10 ))"
         1101                 if [ $sleeptime -gt 60 ];
         1102                 then
         1103                         sleep "$(( $RANDOM % 30 + 20 ))"
         1104                         annna-say "${IRC_CMD_USER}, *swish* *swish* old annnama is still searching."
         1105                         sleeptime="$(( $RANDOM % 60 + 10 ))"
         1106                 fi
         1107                 sleep $sleeptime
         1108 
         1109                 annna-say "${IRC_CMD_USER}, $(trick-or-treat)"
         1110         } & ;;
         1111 "${IRC_USER}, please dance with me"*)
         1112         if [ $(($RANDOM % 2)) -gt 0 ];
         1113         then
         1114                 annna-say "I am not that kind of woman."
         1115         else
         1116                 annna-say "Thank you! Let us dance! :-D"
         1117         fi;;
         1118 "${IRC_USER}, please tell me who is your favourite pleasure man"*) annna-say "My favourite pleasure man is of course Gunther!";;
         1119 "${IRC_USER}, make me a sandwich"*) annna-say "No.";;
         1120 "${IRC_USER}, sudo make me a sandwich"*) annna-say "Humans are no objects.";;
         1121 "${IRC_USER}, please make me a sandwich"*) annna-say "Maybe.";;
         1122 "${IRC_USER}, sudo please make me a sandwich"*) annna-say "Here is your sandwich.";;
         1123 "${IRC_USER}, I feel unsure about my health.")
         1124         healthadvice="$(health-advice)"
         1125         [ -n "${healthadvice}" ] && annna-say "${IRC_CMD_USER}, ${healthadvice}";;
         1126 "${IRC_USER}, bonjour !") annna-say "${IRC_CMD_USER}, bonjour !";;
         1127 *" pets ${IRC_USER}"*) annna-say "${IRC_CMD_USER}, *brrrrr*";;
         1128 "${IRC_USER}, please give me a penis extension"*) annna-say "${IRC_CMD_USER}, here: $(penis-extension)";;
         1129 "${IRC_USER}, please bobbitize me"*) annna-say "${IRC_CMD_USER}, here: $(bobbitize)";;
         1130 "${IRC_USER}, please give me a baguette extension"*) annna-say "${IRC_CMD_USER}, here: $(baguette-extension)";;
         1131 "${IRC_USER}, please give me an allah extension"*) annna-say "${IRC_CMD_USER}, here: $(allah-extension)";;
         1132 "${IRC_USER}, please pull my finger"*) annna-say "${IRC_CMD_USER}, you are disgusting.";;
         1133 "${IRC_USER}, what's up in Japan?") annna-say "${IRC_CMD_USER}, see for yourself: https://nhk3.mov3.co/hls/nhk.m3u8";;
         1134 "${IRC_USER}, please mqtt"*)
         1135         mqtturi="$(printf '%s\n' "${IRC_PRIVMSG_TEXT}" | cut -d' ' -f 3)"
         1136         case "${mqtturi}" in
         1137         mqtt:*);; #mqtt:// full URI specified
         1138         *) mqtturi="mqtts://bitreich:oogui3queex&o9zaekah@bitreich.org/${mqtturi#mqtt}";;
         1139         esac
         1140         msg="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -d' ' -f 4-)"
         1141         printf "${msg}\n" | mosquitto_pub -L "${mqtturi}" -l;;
         1142 *[Zz]"uckerberg"*) annna-say "${IRC_CMD_USER}, did you mean gophers://bitreich.org/9/memecache/mark-suckerberg.mp4 ?";;
         1143 "${IRC_USER}, please pick one of: "*)
         1144         pick="$(printf '%s\n' "${IRC_PRIVMSG_TEXT}" \
         1145                 | sed 's/.*please pick one of: //' \
         1146                 | tr ',' '\n' \
         1147                 | tr -d ' ' \
         1148                 | sort -R \
         1149                 | head -n 1)"
         1150         annna-say "${IRC_CMD_USER}, I think ${pick} is the best option.";;
         1151 "${IRC_USER}, please play some Bach"*)
         1152         midifile="$(find . /home/annna/bin/modules/midi-media/bach -name '*.mid' \
         1153                 | sort -R \
         1154                 | head -n 1)"
         1155         outfile="/br/gopher/midi/${midifile##*/}.ogg"
         1156         midi-play "$midifile" >"$outfile" && annna-say "${IRC_CMD_USER}, gophers://bitreich.org/9/midi/${outfile##*/}";;
         1157 "${IRC_USER}, please 3d "*)
         1158         args=$(echo ${IRC_PRIVMSG_TEXT} | cut -d' ' -f 4-)
         1159         outfile=$(blender-effect $args)
         1160         annna-say "${IRC_CMD_USER}, gophers://bitreich.org/I/memecache/3d/${outfile}";;
         1161 # https://ednaundharvey.fandom.com/de/wiki/Droggelbecher
         1162 "${IRC_USER}, droggelbecher"*) annna-say "${IRC_CMD_USER}, Droggelbecher!";;
         1163 "${IRC_USER}, thanks"*|"${IRC_USER}, thx"*) annna-say "${IRC_CMD_USER}, you're welcome.";;
         1164 "${IRC_USER}, please simulate "*" simulator"*)
         1165         q="${IRC_PRIVMSG_TEXT#* please simulate }"
         1166         q="${q% simulator*}"
         1167         outpath="/br/gopher/p/"
         1168         {
         1169                 if outfile="$(simulate-simulator "$q")"
         1170                 then
         1171                         mv "${outfile}" "${outpath}/"
         1172                         annna-say "${IRC_CMD_USER}, gophers://bitreich.org/I/p/${outfile}"
         1173                 fi
         1174         } & ;;
         1175 "${IRC_USER}, can "*" certify itself?")
         1176         q="${IRC_PRIVMSG_TEXT#* can }"
         1177         q="${q% certify*}"
         1178         {
         1179                 # host:port is needed for tlsgrab
         1180                 curi="$(tlsgrab "${q}")"
         1181                 if [ -n "${curi}" ];
         1182                 then
         1183                         annna-say "${IRC_CMD_USER}, let us see the certificate: ${curi}"
         1184                 fi
         1185         } & ;;
         1186 "${IRC_USER}, please mine "*" bitreichcoin"*)
         1187         q="${IRC_PRIVMSG_TEXT#* please mine }"
         1188         q="${q% bitreichcoin*}"
         1189         curi="$(bitreichcoin "$q" | bitreich-paste)"
         1190         annna-say "${IRC_CMD_USER}, please don't spend it all at once: ${curi}";;
         1191 "${IRC_USER}, please hug me.") annna-say "$(echo -e '\001')ACTION hugs ${IRC_CMD_USER}$(echo -e '\001')";;
         1192 "${IRC_USER}, please hug "*" for me.")
         1193         huggee="${IRC_PRIVMSG_TEXT#* please hug }"
         1194         huggee="${huggee% for me*}"
         1195         [ -n "${huggee}" ] && annna-say "$(echo -e '\001')ACTION hugs ${huggee}$(echo -e '\001')";;
         1196 "${IRC_USER}, how many fucks were given?") annna-say "${IRC_CMD_USER}, current fucks given: 0.0";;
         1197 "${IRC_USER}, please slam the door.") annna-say "${IRC_CMD_USER}, *BANG*";;
         1198 "${IRC_USER}, what is my credit score?") annna-say "${IRC_CMD_USER}, your credit score is 0.";;
         1199 "${IRC_USER}, please give me a cookie.")
         1200         cookie="$(cookie)"
         1201         [ -n "${cookie}" ] && annna-say "$(echo -e '\001')ACTION gives ${IRC_CMD_USER} a ${cookie} cookie$(echo -e '\001')";;
         1202 "${IRC_USER}, please help"*) annna-say -c "${IRC_CMD_USER}" "See git://bitreich.org/annna for my commands.";;
         1203 "${IRC_USER}, please meme meme meme me"*)
         1204         randomtag=2
         1205         while [ $randomtag -gt 0 ];
         1206         do
         1207                 rtag="$(printf "%s\n" "$(hashtags)" | shuf -n 1)"
         1208                 tagname=""
         1209                 taguri=""
         1210                 for tag in ${rtag};
         1211                 do
         1212                         [ -z "${tagname}" ] && tagname="${tag}" && continue
         1213                         taguri="${tag}"
         1214                 done
         1215                 annna-say "${tagname}: ${taguri}"
         1216                 randomtag=$((randomtag - 1))
         1217         done;;
         1218 "${IRC_USER}, what's the wheelchair shooter meme again?")
         1219         tagname="#scrollby"
         1220         tagline="$(printf "%s\n" "$(hashtags)" | grep "^${tagname} ")"
         1221         tagname="$(printf "%s\n" "${tagline}" | cut -d ' ' -f 1)"
         1222         taguri="$(printf "%s\n" "${tagline}" | cut -d ' ' -f 2-)"
         1223         annna-say "${tagname}: ${taguri}";;
         1224 "${IRC_USER}, TIL "*|"${IRC_USER}, til "*)
         1225         minimum_learned_len=12
         1226         offset=$(( ${#IRC_USER} + 6 ))
         1227         learned="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" \
         1228                 | cut -c $offset- \
         1229                 | sed 's,\t,    ,g')"
         1230         if [ ${#learned} -le $minimum_learned_len ];
         1231         then
         1232                 annna-say "${IRC_CMD_USER}, can you explain better what you learned?"
         1233         else
         1234                 result="$(til ${IRC_CMD_USER} "${learned}")"
         1235                 if [ $? -eq 0 ];
         1236                 then
         1237                         annna-say "${IRC_CMD_USER}, ${result}"
         1238                 fi
         1239         fi;;
         1240 "${IRC_USER}, what have I learned?")
         1241         if result=$(til-user ${IRC_CMD_USER});
         1242         then
         1243                 annna-say "${IRC_CMD_USER}, ${result}"
         1244         fi;;
         1245 esac
         1246 
         1247 for person in "${!personalities[@]}";
         1248 do case "${IRC_PRIVMSG_TEXT,,}" in
         1249 "${person}, "*)
         1250         personality="${personalities[${person}]}"
         1251         preprompt="$(cat ${ANNNA_MODBASE}/prompt-agents/${personality}.prompt.txt)"
         1252         prompt="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -d' ' -f 2- | sed 's,\t,    ,g')"
         1253         annna-say "$(gpt "System: ${preprompt}\n User: ${prompt}\n Bot:")" &
         1254 esac done
         1255 
         1256 case "${IRC_PRIVMSG_TEXT}" in
         1257 "${IRC_USER}, please antidepressant #"*|\
         1258 "${IRC_USER}, please amplify #"*|\
         1259 "${IRC_USER}, please amsterdamify #"*|\
         1260 "${IRC_USER}, please banjo #"*|\
         1261 "${IRC_USER}, please bounce #"*|\
         1262 "${IRC_USER}, please breakingnews #"*|\
         1263 "${IRC_USER}, please celtify #"*|\
         1264 "${IRC_USER}, please concatenate #"*|\
         1265 "${IRC_USER}, please crimetv #"*|\
         1266 "${IRC_USER}, please curb #"*|\
         1267 "${IRC_USER}, please daybowbow #"*|\
         1268 "${IRC_USER}, please deathmetal #"*|\
         1269 "${IRC_USER}, please developers #"*|\
         1270 "${IRC_USER}, please dontdoit #"*|\
         1271 "${IRC_USER}, please dontsaytoyourmother #"*|\
         1272 "${IRC_USER}, please doomify #"*|\
         1273 "${IRC_USER}, please dutchapprove #"*|\
         1274 "${IRC_USER}, please french #"*|\
         1275 "${IRC_USER}, please FRENCH #"*|\
         1276 "${IRC_USER}, please imam #"*|\
         1277 "${IRC_USER}, please lop #"*|\
         1278 "${IRC_USER}, please loop #"*|\
         1279 "${IRC_USER}, please looop #"*|\
         1280 "${IRC_USER}, please loooop #"*|\
         1281 "${IRC_USER}, please mow #"*|\
         1282 "${IRC_USER}, please namflashback #"*|\
         1283 "${IRC_USER}, please news #"*|\
         1284 "${IRC_USER}, please pullmyfinger #"*|\
         1285 "${IRC_USER}, please putin #"*|\
         1286 "${IRC_USER}, please reverse #"*|\
         1287 "${IRC_USER}, please richardstrauss #"*|\
         1288 "${IRC_USER}, please ritual #"*|\
         1289 "${IRC_USER}, please sadviolin #"*|\
         1290 "${IRC_USER}, please science #"*|\
         1291 "${IRC_USER}, please scrollify #"*|\
         1292 "${IRC_USER}, please sendtohell #"*|\
         1293 "${IRC_USER}, please sexify #"*|\
         1294 "${IRC_USER}, please slavify #"*|\
         1295 "${IRC_USER}, please slowdown #"*|\
         1296 "${IRC_USER}, please smith #"*|\
         1297 "${IRC_USER}, please speedup #"*|\
         1298 "${IRC_USER}, please techno #"*|\
         1299 "${IRC_USER}, please technodrugs #"*|\
         1300 "${IRC_USER}, please thin #"*|\
         1301 "${IRC_USER}, please torture #"*|\
         1302 "${IRC_USER}, please tshirt #"*|\
         1303 "${IRC_USER}, please trumpapprove #"*|\
         1304 "${IRC_USER}, please USAUSA #"*|\
         1305 "${IRC_USER}, please USA #"*|\
         1306 "${IRC_USER}, please usa #"*|\
         1307 "${IRC_USER}, please wat #"*|\
         1308 "${IRC_USER}, please widen #"*|\
         1309 "${IRC_USER}, please ww1 #"*|\
         1310 "${IRC_USER}, please yellow #"*|\
         1311 "${IRC_USER}, please zucc #"*|\
         1312 "${IRC_USER}, please random #"*)
         1313         hashtag="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | sed 's/.*#//; s/ .*//' )"
         1314         recipient="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | sed 's/.* for //' )"
         1315         [ -z "${recipient}" ] && recipient="${IRC_CMD_USER}"
         1316         origext="$(grep -E "^#${hashtag} " "${hashtagfile}" | sed 's/.*\.//')"
         1317         {
         1318                 filter="$(printf '%s\n' "${IRC_PRIVMSG_TEXT}" | cut -d' ' -f3)"
         1319                 if [ "${filter}" = "random" ];
         1320                 then
         1321                         filters=("antidepressant" "amplify" "amsterdamify"
         1322                                  "banjo" "bounce" "breakingnews"
         1323                                  "celtify" "concatenate" "crimetv"
         1324                                  "curb" "daybowbow" "deathmetal"
         1325                                  "developers" "dontdoit" "dontsaytoyourmother"
         1326                                  "doomify" "dutchapprove" "french"
         1327                                  "FRENCH" "imam" "lop" "loop" "looop" "loooop"
         1328                                  "mow" "namflashback" "news"
         1329                                  "pullmyfinger" "putin" "reverse"
         1330                                  "richardstrauss" "ritual" "sadviolin"
         1331                                  "science" "scrollify" "sendtohell"
         1332                                  "sexify" "slavify" "slowdown"
         1333                                  "smith" "speedup" "techno"
         1334                                  "technodrugs" "thin" "torture"
         1335                                  "tshirt" "trumpapprove" "USAUSA"
         1336                                  "usa" "wat" "widen" "ww1"
         1337                                  "yellow" "zucc")
         1338                         filter="${filters[ $RANDOM % ${#filters[@]} ]}"
         1339                 fi
         1340                 outfile="${filter}-${hashtag}.mkv"
         1341                 outpath="/br/gopher/memecache/filter/${outfile}"
         1342                 inpath="/br/gopher/memecache/${hashtag}.${origext}"
         1343 
         1344                 [ ! -f "${inpath}" ] && exit 0
         1345 
         1346                 # outfile and outpath filtering for the cache.
         1347                 case "${filter}" in
         1348                 antidepressant|ritual|putin|tshirt)
         1349                         outfile="${outfile%.*}.jpg"
         1350                         outpath="${outpath%.*}.jpg";;
         1351                 wat|smith|zucc)
         1352                         mimetype="$(file --mime-type "$inpath" | cut -d':' -f 2 | cut -c 2-)"
         1353                         # Only allow images to be free.
         1354                         case "$mimetype" in
         1355                         image/webp)
         1356                                 # deface does not like webp. Make it png.
         1357                                 newinpath="$(mktemp -u -p /tmp "${infile%.*}XXXXX.png")"
         1358                                 magick "${inpath}" "${newinpath}" >/dev/null 2>&1
         1359                                 inpath="${newinpath}"
         1360 
         1361                                 outfile="${outfile%.*}.png"
         1362                                 outpath="${outpath%.*}.png";;
         1363                         image/*)
         1364                                 outfile="${outfile%.*}.${origext}"
         1365                                 outpath="${outpath%.*}.${origext}";;
         1366                         esac
         1367                 esac
         1368                 # Cleanup if outpath file is empty.
         1369                 [ -f "${outpath}" ] && [ ! -s "${outpath}" ] && rm "${outpath}"
         1370 
         1371                 # determine gopher type for output file
         1372                 outmimetype="$(file -ib "${outpath}")"
         1373                 case "$outmimetype" in
         1374                 image/*) outtype="I";;
         1375                 *) outtype="9";;
         1376                 esac
         1377 
         1378                 if [ -s "${outpath}" ];
         1379                 then
         1380                         annna-say "${recipient}, gophers://bitreich.org/${outtype}/memecache/filter/${outfile}"
         1381                         exit 0
         1382                 fi
         1383 
         1384                 case "${filter}" in
         1385                 antidepressant) antidepressant "${inpath}" "${outpath}" >/dev/null 2>&1;;
         1386                 ritual) satanic-ritual "${inpath}" "${outpath}" >/dev/null 2>&1;;
         1387                 putin) putin-os "${inpath}" "${outpath}" >/dev/null 2>&1;;
         1388                 tshirt) tshirt-design "${inpath}" "${outpath}" >/dev/null 2>&1;;
         1389                 *) ffmpeg-effect "${filter}" "${inpath}" "${outpath}" >/dev/null 2>&1;;
         1390                 esac
         1391 
         1392                 # Remove temporary png for deface.
         1393                 case "${inpath}" in
         1394                 /tmp/*.png) [ -e "${inpath}" ] && rm "${inpath}";;
         1395                 esac
         1396 
         1397                 [ -s "${outpath}" ] && annna-say "${recipient}, gophers://bitreich.org/${outtype}/memecache/filter/${outfile}"
         1398         } &
         1399         exit 0;;
         1400 esac
         1401 
         1402 printf '%s' "${IRC_PRIVMSG_TEXT}" | awk -v taglimit="$printnhashtags" '
         1403 $0 !~ /#nospoil/ {
         1404         while (match($0, /[#*&]+[^# /"'\'',?!;$\001]+/)) {
         1405                 tag = substr($0, RSTART, RLENGTH)
         1406                 $0 = substr($0, RSTART + RLENGTH)
         1407                 sub(/[.]*$/, "", tag)
         1408                 if (!uniq[tag]++ && taglimit-- > 0)
         1409                         print tag
         1410         }
         1411 }' | head -n "$printnhashtags" | while read -r tag;
         1412 do
         1413         [ "${tag}" = "#expand" ] && continue
         1414 
         1415         origtag="${tag}"
         1416         pointer=0
         1417         revpointer=0
         1418         case "${tag}" in
         1419         "*"*)   tag="#$(printf "%s\n" "${tag}" | sed "s,^[\*]*,,")"
         1420                 pointer=1;;
         1421         "&"*)   tag="#$(printf "%s\n" "${tag}" | sed "s,^[\&]*,,")"
         1422                 revpointer=1;;
         1423         esac
         1424 
         1425         tagline="$(grep "${tag} " "${hashtagfile}" | shuf -n 1)";
         1426         if [ -n "${tagline}" ];
         1427         then
         1428                 if [ $nospoil -eq 0 ];
         1429                 then
         1430                         if [ $pointer -eq 1 ];
         1431                         then
         1432                                 inpath="/br/gopher/memecache/${tagline##*/}"
         1433                                 [ ! -f "${inpath}" ] && exit 0
         1434 
         1435                                 outfile="${tag#\#}.jpg"
         1436                                 # pointy pointers
         1437                                 outpath="$(printf "%s\n" "${origtag}" \
         1438                                 | sed 's,\*,&\n,g' \
         1439                                 | grep "^*" \
         1440                                 | while read -r asterisk;
         1441                                 do
         1442                                         outfile="*${outfile}"
         1443                                         outpath="/br/gopher/memecache/filter/${outfile}"
         1444                                         printf "%s\n" "${outpath}"
         1445                                         if [ -e "${outpath}" ];
         1446                                         then
         1447                                                 inpath="${outpath}";
         1448                                                 continue
         1449                                         fi
         1450                                         pointer "${inpath}" "${outpath}";
         1451                                         inpath="${outpath}";
         1452                                 done | tail -n 1)"
         1453 
         1454                                 if [ -e "${outpath}" ];
         1455                                 then
         1456                                         outfile="$(basename "${outpath}")"
         1457                                         annna-say "${origtag}: gophers://bitreich.org/9/memecache/filter/${outfile}"
         1458                                 fi
         1459                         elif [ $revpointer -eq 1 ];
         1460                         then
         1461                                 inpath="/br/gopher/memecache/${tagline##*/}"
         1462                                 [ ! -f "${inpath}" ] && exit 0
         1463 
         1464                                 outfile="${tag#\#}.jpg"
         1465                                 # pointy pointers
         1466                                 outpath="$(printf "%s\n" "${origtag}" \
         1467                                 | sed 's,\&,&\n,g' \
         1468                                 | grep "^&" \
         1469                                 | while read -r asterisk;
         1470                                 do
         1471                                         outfile="&${outfile}"
         1472                                         outpath="/br/gopher/memecache/filter/${outfile}"
         1473                                         printf "%s\n" "${outpath}"
         1474                                         if [ -e "${outpath}" ];
         1475                                         then
         1476                                                 inpath="${outpath}";
         1477                                                 continue
         1478                                         fi
         1479                                         revpointer "${inpath}" "${outpath}" >/dev/null 2>&1;
         1480                                         inpath="${outpath}";
         1481                                 done | tail -n 1)"
         1482 
         1483                                 if [ -e "${outpath}" ];
         1484                                 then
         1485                                         outfile="$(basename "${outpath}")"
         1486                                         annna-say "${origtag}: gophers://bitreich.org/9/memecache/filter/${outfile}"
         1487                                 fi
         1488                         else
         1489                                 annna-say "${tagline% *}: ${tagline#* }"
         1490                         fi
         1491                 fi
         1492         else
         1493                 if [ $doexpand -eq 1 ];
         1494                 then
         1495                         taglength=$(utf8expr length "${tag}")
         1496                         if [ $uriexpansion -eq 0 ] && [ $taglength -gt 3 ];
         1497                         then
         1498                                 didyoumean="$(annna-meme-recommend "${tag}")"
         1499                                 if [ -n "${didyoumean}" ];
         1500                                 then
         1501                                         annna-say "Did you mean: ${didyoumean}?"
         1502                                 fi
         1503                         fi
         1504                 fi
         1505         fi
         1506 done
         1507 
         1508 case "${IRC_PRIVMSG_TEXT,,}" in
         1509 *\#nospoil*);;
         1510 *rfc[0-9]*)
         1511         rfcname="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | sed 's,.*\(rfc[0-9]*\).*,\1,')"
         1512         annna-say "${rfcname}: ftp://ftp.rfc-editor.org/in-notes/${rfcname}.txt";;
         1513 esac
         1514 
         1515 # Always keep the karma / shame last!
         1516 case "${IRC_PRIVMSG_TEXT}" in
         1517 *"-shaming"*)
         1518         shametext="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | sed 's,.* \(.*-shaming\).*,\1,')"
         1519         shame "${shametext}" >/dev/null;;
         1520 *"arma is a bitch"*) annna-say "${IRC_CMD_USER}, I object! Karma is a nice girl!";;
         1521 # For referee scoring.
         1522 "score "*);;
         1523 *++|*--|*-=?|*+=?|*+=-?|*-=-?)
         1524         karmatext="$(karma "${IRC_PRIVMSG_TEXT}")"
         1525         [ -n "$karmatext" ] && annna-say "karma: ${karmatext}";;
         1526 esac
         1527 
         1528 # Membership Level.
         1529 ismember=0
         1530 for member in $brmembers;
         1531 do
         1532         [ "${IRC_CMD_USER}" = "${member}" ] && ismember=1
         1533 done
         1534 [ $ismember -lt 1 ] && exit
         1535 
         1536 case "${IRC_PRIVMSG_TEXT}" in
         1537 "${IRC_USER}, please go to sleep.")
         1538         annna-say "Going to sleep ... Zzzz ..."
         1539         annna-sleep-well;;
         1540 "${IRC_USER}, please wake up.")
         1541         annna-wakeup
         1542         annna-say "Good morning BITREICH!";;
         1543 "${IRC_USER}, can you show me the uptime please?") annna-say "$(hostname) uptime: $(uptime)";;
         1544 "${IRC_USER}, please show me the load.") annna-say "$(hostname) load: $(LANG=C uptime | sed 's,.*load average: \(.*\)$,\1,')";;
         1545 "${IRC_USER}, please give me the count of online users.") annna-say "$(hostname): $(who -q | tail -n 1 | cut -d'=' -f 2)";;
         1546 "${IRC_USER}, please update the phlog index.")
         1547         phlog-index > /dev/null 2>&1
         1548         annna-say "Thanks! Your request has been fulfilled with the quickness! :)";;
         1549 esac
         1550 
         1551 # Referee Level.
         1552 isreferee=0
         1553 for referee in $referees;
         1554 do
         1555         [ "$user" = "$referee" ] && isreferee=1
         1556 done
         1557 [ $isreferee -lt 1 ] && exit
         1558 
         1559 case "${IRC_PRIVMSG_TEXT}" in
         1560 "score "*)
         1561         text="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -d' ' -f2-)"
         1562         case "${IRC_PRIVMSG_TEXT}" in
         1563         *++|*--|*-=?|*+=?|*+=-?|*-=-?|*-=??|*+=??|*-=-??|*-=65536*)
         1564                 scoretext="$(brcon-score "${IRC_PRIVMSG_TEXT}")"
         1565                 [ -n "$scoretext" ] && annna-say "brcon score: ${scoretext}";;
         1566         esac;;
         1567 esac
         1568