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