Unify ircuser for botname, add checks for server init states. - 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 --- DIR commit ec22e9243762308cd625e5ea38139c37cfdb5743 DIR parent 3231049cfc232eef8ead295c968c6c56aaf68140 HTML Author: Annna Robert-Houdin <annna@bitreich.org> Date: Sat, 6 Aug 2022 21:22:56 +0200 Unify ircuser for botname, add checks for server init states. This unifies how we handle how the bot is named. No double naming. The join init state and motd are checked now. Diffstat: M annna-join-channels | 12 ++++++++++-- M annna-message-common | 262 ++++++++++++++++---------------- M annna-message-gopherproject | 4 ++-- M annna-message-radio | 10 +++++----- M annna-start-main | 25 ++++++++++++------------- 5 files changed, 160 insertions(+), 153 deletions(-) --- DIR diff --git a/annna-join-channels b/annna-join-channels @@ -8,6 +8,8 @@ ircbase="$(cat ${cfgbase}/ircbase)" server="$1" channels="$2" +export ircuser="$(cat ${cfgbase}/${server}/ircuser 2>/dev/null)" + # Channels for chan in ${channels}; do @@ -23,8 +25,14 @@ do sleep 1 done - # There is no guaranteed way to make sure, you are in some channel. - sleep 2 + ## Check if we have joined and received the message from the server. + while [ -z "$(cat ${ircbase}/${server}/${chan}/out \ + | head -n 1 \ + | grep ".* ${ircuser}.* ${chan}.*")" ]; + do + [ ! -f ${cfgbase}/running ] && exit 1 + sleep 2 + done annna-start-service "${server}" "${chan}" done DIR diff --git a/annna-message-common b/annna-message-common @@ -5,13 +5,13 @@ export PATH="/br/bin:$PATH" cfgbase="$(pwd)" ircbase="$(cat ${cfgbase}/ircbase)" modbase="$(cat ${cfgbase}/modbase)" -botname="$(cat ${cfgbase}/botname)" hashtagfile="${modbase}/hashtags/hashtags.txt" idontcaredb="${modbase}/i-dont-care/i-dont-care.txt" printnhashtags=2 brmembers="__20h__ Evil_Bob chripo posativ quinq stateless solene josuah parazyd bin KatolaZ adc" server="$1" +ircuser="$(cat ${cfgbase}/${server}/ircuser)" channel="$2" user="$3" text="$4" @@ -31,7 +31,7 @@ regeximatch() { #printf "%s %s %s %s\n" "${0##*/}" "${channel}" "${user}" "${text}" -[ "$user" = "${botname}" ] && exit 0 +[ "$user" = "${ircuser}" ] && exit 0 case "${text}" in *\#nospoil*) @@ -208,26 +208,26 @@ case "${text}" in esac case "${text}" in -"Thanks ${botname}"*) +"Thanks ${ircuser}"*) annna-say -s "${server}" -c "${channel}" "${user}, you are welcome." ;; *" ope sorry"*|"ope sorry"*) annna-say -s "${server}" -c "${channel}" "${user}, 😃pe sorry." ;; -"${botname}, what the karma?") +"${ircuser}, what the karma?") annna-say -s "${server}" -c "${channel}" "${user}, gopher://bitreich.org/1/irc/karma" ;; -"${botname}, what the shame?") +"${ircuser}, what the shame?") annna-say -s "${server}" -c "${channel}" "${user}, gopher://bitreich.org/1/irc/shame" ;; *"don't care"*) dontcaresay="$(shuf -n 1 ${idontcaredb})" annna-say -s "${server}" -c "${channel}" "${user}, ${dontcaresay}" ;; -"${botname}, how can I phlog on bitreich?") +"${ircuser}, how can I phlog on bitreich?") annna-say -s "${server}" -c "${channel}" "${user}, please read: gopher://bitreich.org/0/usr/20h/phlog/2017-08-26T20-04-02-482296.md and gopher://bitreich.org/0/usr/20h/phlog/2017-08-26T20-27-40-281825.md" ;; -"${botname}, what is "*) +"${ircuser}, what is "*) word="$(printf "%s\n" "${text}" | cut -c 16-)" case "$word" in *\?) @@ -275,7 +275,7 @@ case "${text}" in esac annna-say -s "${server}" -c "${channel}" "${puri}" ;; -"${botname}, cowsay "*) +"${ircuser}, cowsay "*) word="$(printf "%s\n" "${text}" | cut -c 15-)" tmpf=$(mktemp) cowsayasaservice ${word} > ${tmpf} @@ -285,21 +285,21 @@ case "${text}" in fi rm ${tmpf} 2>/dev/null ;; -"${botname}, please give me the unix power.") +"${ircuser}, please give me the unix power.") upcuri="$(unix-power)" if [ -n "${upcuri}" ]; then annna-say -s "${server}" -c "${channel}" "${user}, ${upcuri}" fi ;; -"${botname}, play despacito plz.") +"${ircuser}, play despacito plz.") annna-say -s "${server}" -c "${channel}" "${user}, gopher://bitreich.org/9/memecache/despacito.mkv" ;; -"${botname}, please give me a Chuck Norris fact.") +"${ircuser}, please give me a Chuck Norris fact.") chuck=$(chucknorris) annna-say -s "${server}" -c "${channel}" "${user}, ${chuck}" ;; -"${botname}, please show me ip art.") +"${ircuser}, please show me ip art.") annna-say -s "${server}" -c "${channel}" "${user}, please see #bitreich-tv for the magic." { cd $HOME/bin/modules/ip-art; @@ -307,7 +307,7 @@ case "${text}" in flock $HOME/bin/modules/ip-art -c "./display-file.sh ip-art.ipart" } & ;; -"${botname}, I feel button.") +"${ircuser}, I feel button.") buri="$(button-gen)" if [ -n "${buri}" ]; then @@ -316,7 +316,7 @@ case "${text}" in annna-say -s "${server}" -c "${channel}" "${user}, sorry, no feelings for you today." fi ;; -"${botname}, I feel stupid.") +"${ircuser}, I feel stupid.") nuri=$(darwin) tmpf=$(mktemp) fetch-uri "${nuri}" > "${tmpf}" @@ -324,35 +324,35 @@ case "${text}" in annna-say -s "${server}" -c "${channel}" "${user}, do not feel stupid, others are more stupid: ${curi}" rm ${tmpf} 2>/dev/null ;; -"${botname}, I feel down.") +"${ircuser}, I feel down.") postmortem="$(post-mortem | /br/bin/bitreich-paste)" annna-say -s "${server}" -c "${channel}" "${user}, do not feel bad, others had worse days: ${postmortem}" ;; -"${botname}, I feel perl.") +"${ircuser}, I feel perl.") perlfeelings="$(perl-feelings)" if [ -n "${perl-feelings}" ]; then annna-say -s "${server}" -c "${channel}" "${user}, I feel ${perlfeelings}" fi ;; -"${botname}, will you be my girlfriend?") +"${ircuser}, will you be my girlfriend?") rejection="$(girlfriend)" annna-say -s "${server}" -c "${channel}" "${user}, ${rejection}" ;; -"${botname}, who fights crime?"|"${botname}, who is fighting crime?") +"${ircuser}, who fights crime?"|"${ircuser}, who is fighting crime?") partner=$(echo $brmembers | awk '{for (i = 1; i < NF; i++) print $i}' | grep -v "^{$user}" | shuf -n 1) crimefighter="$(theyfightcrime ${user} ${partner})" annna-say -s "${server}" -c "${channel}" "${crimefighter}" ;; -"${botname}, please give me a commit message.") +"${ircuser}, please give me a commit message.") commitmsg="$(whatthecommit)" annna-say -s "${server}" -c "${channel}" "${commitmsg}" ;; -"${botname}, birp.") +"${ircuser}, birp.") birdname="$(bird-name)" annna-say -s "${server}" -c "${channel}" "${user}, I heard a ${birdname} bird." ;; -"${botname}, please oneline me.") +"${ircuser}, please oneline me.") randomoneliner="$(oneliner)" if [ -z "${randomoneliner}" ]; then @@ -368,7 +368,7 @@ case "${text}" in annna-say -s "${server}" -c "${channel}" "Have you tried? ${maemoapp}" fi ;; -"${botname}, man "*|"${botname}, man "*) +"${ircuser}, man "*|"${ircuser}, man "*) exp="$(printf "%s\n" "${text}" | cut -c 12- | sed 's,\t, ,g')" dresult="$(COLUMNS=80 man "${exp}" 2>/dev/null)" @@ -381,31 +381,31 @@ case "${text}" in annna-say -s "${server}" -c "${channel}" "${puri}" ;; -"${botname}, please pray for me.") +"${ircuser}, please pray for me.") annna-say -s "${server}" -c "${channel}" "${user}, here, for you: gopher://bitreich.org/9/memecache/llaminim.mkv" ;; -"${botname}, nigger.") +"${ircuser}, nigger.") nword="$(n-word)" annna-say -s "${server}" -c "${channel}" "${user}, don't use the ${nword}!" ;; -"${botname}, why was I breached?") +"${ircuser}, why was I breached?") breachtext="$(why-was-i-breached)" if [ -n "${breachtext}" ]; then annna-say -s "${server}" -c "${channel}" "${user}, ${breachtext}" fi ;; -"${botname}, please be responsible about "*) +"${ircuser}, please be responsible about "*) word="$(printf "%s\n" "${text}" | cut -c 36- | sed 's,\t, ,g')" suri="$(responsibility "${word}" | bitreich-paste)" annna-say -s "${server}" -c "${channel}" "${suri}" ;; -"${botname}, please say "*) +"${ircuser}, please say "*) word="$(printf "%s\n" "${text}" | cut -c 19- | sed 's,\t, ,g')" suri="$(printf "%s\n" "${word}" | bitreich-speak)" annna-say -s "${server}" -c "${channel}" "${suri}" ;; -"${botname}, what can I cook with "*) +"${ircuser}, what can I cook with "*) ingredients="$(printf "%s\n" "${text}" | cut -c 29- | sed 's,\t, ,g')" case "$ingredients" in *\?) @@ -422,7 +422,7 @@ case "${text}" in annna-say -s "${server}" -c "${channel}" "${user}, I could not find any recipes for you." fi ;; -"${botname}, wolfram is "*) +"${ircuser}, wolfram is "*) word="$(printf "%s\n" "${text}" | cut -c 19- | sed 's,\t, ,g')" case "$word" in *\?) @@ -469,15 +469,15 @@ case "${text}" in fi annna-say -s "${server}" -c "${channel}" -- "${puri}" ;; -"${botname}, pray"*) +"${ircuser}, pray"*) # Emulate https://threats.kaspersky.com/en/threat/IRC-Worm.DOS.Septic/ annna-say -s "${server}" -c "${channel}" "${user}, I Obey my master! long live satan" ;; -"${botname}, sacrifice"*) +"${ircuser}, sacrifice"*) # Emulate https://threats.kaspersky.com/en/threat/IRC-Worm.DOS.Septic/ annna-say -s "${server}" -c "${channel}" "${user}, Your word is my command, Power to satan!" ;; -"${botname}, textsynth is "*) +"${ircuser}, textsynth is "*) word="$(printf "%s\n" "${text}" | cut -c 21- | sed 's,\t, ,g')" case "$word" in *\?) @@ -498,7 +498,7 @@ case "${text}" in } & ;; -"${botname}, how discriminating is "*) +"${ircuser}, how discriminating is "*) word="$(printf "%s\n" "${text}" | cut -c 30- | sed 's,\t, ,g')" case "$word" in *\?) @@ -515,7 +515,7 @@ case "${text}" in fi ;; -"${botname}, are "*) +"${ircuser}, are "*) case "${text}" in *" in love?") words="$(printf "%s\n" "${text}" | sed 's,.*are \(.*\) and \(.*\) in love?,\1 \2,')" @@ -529,43 +529,43 @@ case "${text}" in ;; esac ;; -"Ok, ${botname}"*) +"Ok, ${ircuser}"*) annna-say -s "${server}" -c "${channel}" "${user}, I am not a consumer device." ;; -"ok, ${botname}"*) +"ok, ${ircuser}"*) annna-say -s "${server}" -c "${channel}" "${user}, I am not a consumer device." ;; -"${botname}, please shoot "*|"${botname}, plese shoot "*) +"${ircuser}, please shoot "*|"${ircuser}, plese shoot "*) word="$(printf "%s\n" "${text}" | cut -c 21-)" annna-say -s "${server}" -c "${channel}" "${word}, pew pew." ;; -"${botname}, please flip "*) +"${ircuser}, please flip "*) word="$(printf "%s\n" "${text}" | cut -c 20-)" updownword="$(updown "${word}")" annna-say -s "${server}" -c "${channel}" "${word} -> ${updownword}" ;; -"${botname}, please australize "*) +"${ircuser}, please australize "*) word="$(printf "%s\n" "${text}" | cut -c 26-)" updownword="$(updown "${word}")" annna-say -s "${server}" -c "${channel}" "${word} -> ${updownword}" ;; -"${botname}, please give me a good band name.") +"${ircuser}, please give me a good band name.") bandname="$(bandname-gen | shuf | head -n 1)" annna-say -s "${server}" -c "${channel}" "${bandname}" ;; -"${botname}, I am horny.") +"${ircuser}, I am horny.") essaypaste="$(bithub-gen)" annna-say -s "${server}" -c "${channel}" \ "Here is some intellectual porn for you: ${essaypaste}" ;; -"${botname}, please turn on "*) +"${ircuser}, please turn on "*) word="$(printf "%s\n" "${text}" | cut -c 22-)" annna-say -s "${server}" -c "${channel}" "☞ ⏻ ${word}" ;; -"${botname}, please turn me on.") +"${ircuser}, please turn me on.") annna-say -s "${server}" -c "${channel}" "☞ ⏻ ${user}" ;; -"${botname}, I'm game bored.") +"${ircuser}, I'm game bored.") gamelink="$(abandonware-random-game)" if [ -z "${gamelink}" ]; then @@ -574,21 +574,21 @@ case "${text}" in annna-say -s "${server}" -c "${channel}" "${user}, have you tried ${gamelink} ?" fi ;; -"${botname}, I need a waifu.") +"${ircuser}, I need a waifu.") waifuuris="$(waifu-gen)" if [ -n "${waifuuris}" ]; then annna-say -s "${server}" -c "${channel}" "${user}, ${waifuuris}" fi ;; -"${botname}, I need an anime.") +"${ircuser}, I need an anime.") animeuri="$(anime-gen)" if [ -n "${animeuri}" ]; then annna-say -s "${server}" -c "${channel}" "${user}, ${animeuri}" fi ;; -"${botname}, I'm gopher bored.") +"${ircuser}, I'm gopher bored.") randomlink="$(/br/bin/bitreich-lawn-random-link)" linktype="$(printf "%s\n" "${randomlink}" | cut -d '|' -f1 | cut -c2-)" linktext="$(printf "%s\n" "${randomlink}" | cut -d '|' -f2)" @@ -606,21 +606,21 @@ case "${text}" in fi annna-say -s "${server}" -c "${channel}" "$outtext" ;; -"${botname}, wb.") +"${ircuser}, wb.") annna-say -s "${server}" -c "${channel}" "${user}, ty! I am so happy to be here. :)" ;; -"${botname}, bon"*) +"${ircuser}, bon"*) insult="$(bonjour)" annna-say -s "${server}" -c "${channel}" "${user}, ${insult} !" ;; -"${botname}, welcome back.") +"${ircuser}, welcome back.") annna-say -s "${server}" -c "${channel}" "${user}, thank you! I am so happy to be here. :)" ;; -"${botname}, what's up?") +"${ircuser}, what's up?") newsstr="$(ecl -shell /home/solene/gopher/bin/generator.lisp)" annna-say -s "${server}" -c "${channel}" "$newsstr" ;; -"${botname}, what's down?") +"${ircuser}, what's down?") annna-say -s "${server}" -c "${channel}" "${user}, we all love you." ;; *"ACTION cancels "*) @@ -628,11 +628,11 @@ case "${text}" in cancel-target "${mobtarget}" annna-say -s "${server}" -c "${channel}" "${user}, I cancelled ${mobtarget} for you. ( gopher://bitreich.org/I/memecache/cancel-meteor.jpg )" ;; -"${botname}, please show me the mob"*|"${botname}, what are the mob"*) +"${ircuser}, please show me the mob"*|"${ircuser}, what are the mob"*) canceluri="$(get-cancel-list)" annna-say -s "${server}" -c "${channel}" "${user}, ${canceluri}" ;; -"${botname}, I feel sick.") +"${ircuser}, I feel sick.") newsstr="$(cd /br/gopher/hypochondria && ./hypochondria -s random)" annna-say -s "${server}" -c "${channel}" "You could have ${newsstr}! Be careful!" ;; @@ -645,20 +645,20 @@ case "${text}" in *"*waves*"*|*"*wave*"*) annna-say -s "${server}" -c "${channel}" "${user}, *wave*" ;; -"${botname}, please tech hype me.") +"${ircuser}, please tech hype me.") techstr="$(${modbase}/markov_tech/markov)" annna-say -s "${server}" -c "${channel}" "${techstr}" ;; -"${botname}, please coffee read "*) +"${ircuser}, please coffee read "*) readtarget="$(printf "%s\n" "${text}" | cut -c 27-)" horostr="$($HOME/scm/bullshit/horoscope)" annna-say -s "${server}" -c "${channel}" "${readtarget}, ${horostr}" ;; -"${botname}, what's my horoscope?") +"${ircuser}, what's my horoscope?") horostr="$($HOME/scm/bullshit/horoscope)" annna-say -s "${server}" -c "${channel}" "${user}, ${horostr}" ;; -"${botname}, what should I cook"*) +"${ircuser}, what should I cook"*) recipestr="$(based.recipe)" if [ -n "${recipestr}" ]; then @@ -667,11 +667,11 @@ case "${text}" in annna-say -s "${server}" -c "${channel}" "${user}, I have no recommendation for you today." fi ;; -"${botname}, what's my future?") +"${ircuser}, what's my future?") puri="$(sacc gopher://parazyd.org/0/tarot.cgi | /br/bin/bitreich-paste)" annna-say -s "${server}" -c "${channel}" "${user}, your future is here: ${puri}" ;; -"${botname}, haha.") +"${ircuser}, haha.") { # Can take long, so run in background. wuri="$(github-haha)" @@ -681,37 +681,37 @@ case "${text}" in fi } & ;; -"${botname}, how many memes do you know?") +"${ircuser}, how many memes do you know?") annna-say -s "${server}" -c "${channel}" "I know $(hashtagcount) memes: gopher://bitreich.org/1/meme/count" ;; -"${botname}, how many people died of corona?") +"${ircuser}, how many people died of corona?") annna-say -s "${server}" -c "${channel}" "${user}, too many. :( Please see yourself: gopher://magical.fish/1/covid" ;; -"${botname}, please show me your memes.") +"${ircuser}, please show me your memes.") puri="$(printf "%s" "$(hashtags)" | /br/bin/bitreich-paste)" annna-say -s "${server}" -c "${channel}" "Here are my memes: ${puri}" ;; -"${botname}, please show me the victims.") +"${ircuser}, please show me the victims.") puri="$(printf "%s" "$(hashtags)" | grep victim | /br/bin/bitreich-paste)" annna-say -s "${server}" -c "${channel}" "Here are the victims: ${puri}" ;; -"${botname}, please distro-hop with me.") +"${ircuser}, please distro-hop with me.") ndistro="$(curl -s 'https://distrowatch.com/dwres.php?resource=popularity' \ | grep phr2 \ | sed 's,.*href="\(.*\)".*,\1,' \ | sort | uniq | shuf -n 1)" annna-say -s "${server}" -c "${channel}" "How about https://distrowatch.com/${ndistro} ?" ;; -"${botname}, please show me your Macron.") +"${ircuser}, please show me your Macron.") annna-say -s "${server}" -c "${channel}" "gopher://bitreich.org/0/ascii/macron.vt" ;; -"${botname}, release the Kraken!") +"${ircuser}, release the Kraken!") annna-say -s "${server}" -c "${channel}" "Here it is! gopher://bitreich.org/0/memecache/kraken.vt" ;; -"${botname}, release the Quacken!") +"${ircuser}, release the Quacken!") annna-say -s "${server}" -c "${channel}" "Quack Quack! gopher://bitreich.org/9/memecache/release-the-quacken.mkv" ;; -"${botname}, be cool.") +"${ircuser}, be cool.") case "$(($RANDOM % 5))" in 0) annna-say -s "${server}" -c "${channel}" "(⌐■_■)" @@ -730,7 +730,7 @@ case "${text}" in ;; esac ;; -"${botname}, please cheer.") +"${ircuser}, please cheer.") case "$(($RANDOM % 2))" in 0) annna-say -s "${server}" -c "${channel}" '~\o/~' @@ -740,7 +740,7 @@ case "${text}" in ;; esac ;; -"${botname}, be cute.") +"${ircuser}, be cute.") case "$(($RANDOM % 4))" in 0) annna-say -s "${server}" -c "${channel}" ' (\ /)' @@ -772,19 +772,19 @@ case "${text}" in ;; esac ;; -"${botname}, please roll a dice for me.") +"${ircuser}, please roll a dice for me.") annna-say -s "${server}" -c "${channel}" "$((($RANDOM % 6) + 1))" ;; -"${botname}, please tell me your favourite flower.") +"${ircuser}, please tell me your favourite flower.") annna-say -s "${server}" -c "${channel}" "My favourite flower is the beer flower." ;; -"${botname}, please tell me your favourite color.") +"${ircuser}, please tell me your favourite color.") annna-say -s "${server}" -c "${channel}" "My favourite color is yellow." ;; -"${botname}, please clap for me.") +"${ircuser}, please clap for me.") annna-say -s "${server}" -c "${channel}" "${user}, *clap* *clap* *clap*" ;; -"${botname}, which city does not exist?") +"${ircuser}, which city does not exist?") cityuri="$(this-city-does-not-exist)" if [ -n "${cityuri}" ]; then @@ -796,14 +796,14 @@ case "${text}" in "For humanity!") annna-say -s "${server}" -c "${channel}" "${user}, for humanity!" ;; -"${botname}, please dance."|"\o/"|"\^o^/") +"${ircuser}, please dance."|"\o/"|"\^o^/") dancemoves="$(dance-moves-gen)" annna-say -s "${server}" -c "${channel}" -- "${dancemoves}" ;; -"${botname}, please stamp this letter for me.") +"${ircuser}, please stamp this letter for me.") annna-say -s "${server}" -c "${channel}" -- "${user}, here: 🖃 " ;; -"${botname}, please dance with me.") +"${ircuser}, please dance with me.") if [ $(($RANDOM % 2)) -gt 0 ]; then annna-say -s "${server}" -c "${channel}" "I am not that kind of woman." @@ -811,31 +811,31 @@ case "${text}" in annna-say -s "${server}" -c "${channel}" "Thank you! Let us dance! :-D" fi ;; -"${botname}, please tell me who is your favourite pleasure man.") +"${ircuser}, please tell me who is your favourite pleasure man.") annna-say -s "${server}" -c "${channel}" "My favourite pleasure man is of course Gunther!" ;; -"${botname}, make me a sandwich"*) +"${ircuser}, make me a sandwich"*) annna-say -s "${server}" -c "${channel}" "No." ;; -"${botname}, sudo make me a sandwich"*) +"${ircuser}, sudo make me a sandwich"*) annna-say -s "${server}" -c "${channel}" "Humans are no objects." ;; -"${botname}, please make me a sandwich"*) +"${ircuser}, please make me a sandwich"*) annna-say -s "${server}" -c "${channel}" "Maybe." ;; -"${botname}, sudo please make me a sandwich"*) +"${ircuser}, sudo please make me a sandwich"*) annna-say -s "${server}" -c "${channel}" "Here is your sandwich." ;; -"${botname}, bonjour !") +"${ircuser}, bonjour !") annna-say -s "${server}" -c "${channel}" "${user}, bonjour !" ;; -"${botname}, please give me a penis extension.") +"${ircuser}, please give me a penis extension.") annna-say -s "${server}" -c "${channel}" "${user}, here: $(penis-extension)" ;; *"zuckerberg"*|*"Zuckerberg"*) annna-say -s "${server}" -c "${channel}" "${user}, did you mean cocksucker?" ;; -"${botname}, please pick one of: "*) +"${ircuser}, please pick one of: "*) pick="$(printf '%s\n' "${text}" \ | sed 's/.*please pick one of: //' \ | tr ',' '\n' \ @@ -844,40 +844,40 @@ case "${text}" in | head -n 1)" annna-say -s "${server}" -c "${channel}" "${user}, I think ${pick} is the best option." ;; -"${botname}, please antidepressant #"*|\ -"${botname}, please amplify #"*|\ -"${botname}, please amsterdamify #"*|\ -"${botname}, please banjo #"*|\ -"${botname}, please bounce #"*|\ -"${botname}, please celtify #"*|\ -"${botname}, please concatenate #"*|\ -"${botname}, please daybowbow #"*|\ -"${botname}, please dontdoit #"*|\ -"${botname}, please doomify #"*|\ -"${botname}, please dutchapprove #"*|\ -"${botname}, please imam #"*|\ -"${botname}, please loop #"*|\ -"${botname}, please mow #"*|\ -"${botname}, please putin #"*|\ -"${botname}, please reverse #"*|\ -"${botname}, please science #"*|\ -"${botname}, please scrollify #"*|\ -"${botname}, please sendtohell #"*|\ -"${botname}, please sexify #"*|\ -"${botname}, please slavify #"*|\ -"${botname}, please slowdown #"*|\ -"${botname}, please smith #"*|\ -"${botname}, please speedup #"*|\ -"${botname}, please techno #"*|\ -"${botname}, please technodrugs #"*|\ -"${botname}, please thin #"*|\ -"${botname}, please torture #"*|\ -"${botname}, please trumpapprove #"*|\ -"${botname}, please wat #"*|\ -"${botname}, please widen #"*|\ -"${botname}, please ww1 #"*|\ -"${botname}, please yellow #"*|\ -"${botname}, please zucc #"*) +"${ircuser}, please antidepressant #"*|\ +"${ircuser}, please amplify #"*|\ +"${ircuser}, please amsterdamify #"*|\ +"${ircuser}, please banjo #"*|\ +"${ircuser}, please bounce #"*|\ +"${ircuser}, please celtify #"*|\ +"${ircuser}, please concatenate #"*|\ +"${ircuser}, please daybowbow #"*|\ +"${ircuser}, please dontdoit #"*|\ +"${ircuser}, please doomify #"*|\ +"${ircuser}, please dutchapprove #"*|\ +"${ircuser}, please imam #"*|\ +"${ircuser}, please loop #"*|\ +"${ircuser}, please mow #"*|\ +"${ircuser}, please putin #"*|\ +"${ircuser}, please reverse #"*|\ +"${ircuser}, please science #"*|\ +"${ircuser}, please scrollify #"*|\ +"${ircuser}, please sendtohell #"*|\ +"${ircuser}, please sexify #"*|\ +"${ircuser}, please slavify #"*|\ +"${ircuser}, please slowdown #"*|\ +"${ircuser}, please smith #"*|\ +"${ircuser}, please speedup #"*|\ +"${ircuser}, please techno #"*|\ +"${ircuser}, please technodrugs #"*|\ +"${ircuser}, please thin #"*|\ +"${ircuser}, please torture #"*|\ +"${ircuser}, please trumpapprove #"*|\ +"${ircuser}, please wat #"*|\ +"${ircuser}, please widen #"*|\ +"${ircuser}, please ww1 #"*|\ +"${ircuser}, please yellow #"*|\ +"${ircuser}, please zucc #"*) hashtag="$(printf "%s\n" "${text}" | sed 's/.*#//; s/ .*//' )" recipient="$(printf "%s\n" "${text}" | sed 's/.* for //' )" origext="$(grep -E "^#${hashtag} " "${hashtagfile}" | sed 's/.*\.//')" @@ -925,12 +925,12 @@ case "${text}" in } & exit 0 ;; -"${botname}, please 3d "*) +"${ircuser}, please 3d "*) args=$(echo ${text} | cut -d' ' -f 4-) outfile=$(blender-effect $args) annna-say -s "${server}" -c "${channel}" "${user}, gopher://bitreich.org/I/memecache/3d/${outfile}" ;; -"${botname}, please simulate "*" simulator"*) +"${ircuser}, please simulate "*" simulator"*) q="${text#* please simulate }" q="${q% simulator*}" outpath="/br/gopher/p/" @@ -942,13 +942,13 @@ case "${text}" in fi } & ;; -"${botname}, please mine "*" bitreichcoin"*) +"${ircuser}, please mine "*" bitreichcoin"*) q="${text#* please mine }" q="${q% bitreichcoin*}" curi="$(bitreichcoin "$q" | /br/bin/bitreich-paste)" annna-say -s "${server}" -c "${channel}" "${user}, please don't spend it all at once: ${curi}" ;; -"${botname}, please help.") +"${ircuser}, please help.") # Help Message. # TODO: Add multiple line support to annna-say -s "${server}" -c(1) with sleep. annna-say -s "${server}" -c "${user}" "»how many memes do you know?« gets you the number of memes annna knows, ${user}." @@ -1007,7 +1007,7 @@ case "${text}" in sleep 0.5 annna-say -s "${server}" -c "${user}" "»please help.« gives you this help listing, ${user}." ;; -"${botname}, please meme meme meme me.") +"${ircuser}, please meme meme meme me.") randomtag=2 while [ $randomtag -gt 0 ]; do @@ -1025,7 +1025,7 @@ case "${text}" in randomtag=$((randomtag - 1)) done ;; -"${botname}, what's the wheelchair shooter meme again?") +"${ircuser}, what's the wheelchair shooter meme again?") tagname="#scrollby" tagline="$(printf "%s\n" "$(hashtags)" | grep "^${tagname} ")" tagname="$(printf "%s\n" "${tagline}" | cut -d ' ' -f 1)" @@ -1084,16 +1084,16 @@ done [ $ismember -lt 1 ] && exit case "${text}" in -"${botname}, can you show me the uptime please?") +"${ircuser}, can you show me the uptime please?") annna-say -s "${server}" -c "${channel}" "$(hostname) uptime: $(uptime)" ;; -"${botname}, please show me the load.") +"${ircuser}, please show me the load.") annna-say -s "${server}" -c "${channel}" "$(hostname) load: $(LANG=C uptime | sed 's,.*load average: \(.*\)$,\1,')" ;; -"${botname}, please give me the count of online users.") +"${ircuser}, please give me the count of online users.") annna-say -s "${server}" -c "${channel}" "$(hostname): $(who -q | tail -n 1 | cut -d'=' -f 2)" ;; -"${botname}, please update the phlog index.") +"${ircuser}, please update the phlog index.") phlog-index > /dev/null 2>&1 annna-say -s "${server}" -c "${channel}" "Thanks! Your request has been fulfilled with the quickness! :)" ;; DIR diff --git a/annna-message-gopherproject b/annna-message-gopherproject @@ -3,14 +3,14 @@ cfgbase="$(pwd)" ircbase="$(cat ${cfgbase}/ircbase)" modbase="$(cat ${cfgbase}/modbase)" -botname="$(cat ${cfgbase}/botname)" server="$1" +ircuser="$(cat ${cfgbase}/${server}/ircuser)" channel="$2" user="$3" text="$4" -[ "$user" = "${botname}" ] && exit +[ "$user" = "${ircuser}" ] && exit # Nothing so far for gopherproject. DIR diff --git a/annna-message-radio b/annna-message-radio @@ -3,27 +3,27 @@ cfgbase="$(pwd)" ircbase="$(cat ${cfgbase}/ircbase)" modbase="$(cat ${cfgbase}/modbase)" -botname="$(cat ${cfgbase}/botname)" server="$1" +ircuser="$(cat ${cfgbase}/${server}/ircuser)" channel="$2" user="$3" text="$4" -[ "$user" = "${botname}" ] && exit +[ "$user" = "${ircuser}" ] && exit case "${text}" in -"${botname}, next please.") +"${ircuser}, next please.") /br/bin/bitreich-radio-playlist-next annna-say -s "${server}" -c "${channel}" "You are very kind ${user}. To your command." exit # no common messages ;; -"${botname}, please mark this.") +"${ircuser}, please mark this.") songtitle="$(/br/bin/bitreich-radio-playlist-mark)" annna-say -s "${server}" -c "${channel}" "${user}, I have marked \"${songtitle}\" for you." exit ;; -"${botname}, please help.") +"${ircuser}, please help.") annna-say -s "${server}" -c "${user}" "»next please.« gets the playlist further, ${user}." annna-say -s "${server}" -c "${user}" "»please help.« gives you this help listing, ${user}." # Fall back to annna-message-common help message. DIR diff --git a/annna-start-main b/annna-start-main @@ -27,11 +27,10 @@ channels="$4" mkdir -p ${ircbase}/${server} # Connection - export ircuser="$(sed -n 's/^user: //p' ${cfgbase}/${server}/irc-credentials 2>/dev/null)" - ircuserparam="" + export ircuser="$(cat ${cfgbase}/${server}/ircuser)" [ -n "${ircuser}" ] && ircuserparam=" -n ${ircuser}" - export ircpass="$(sed -n 's/^pass: //p' ${cfgbase}/${server}/irc-credentials 2>/dev/null)" + export ircpass="$(cat ${cfgbase}/${server}/ircpass 2>/dev/null)" ircpassparam="" [ -n "${ircpass}" ] && ircpassparam=" -k ircpass" @@ -47,7 +46,7 @@ channels="$4" # -f "${fullname}" -p ${port} & ii -s "${server}"${ircpassparam}${ircuserparam}${tlsparam} \ - -f "${fullname}" -p ${port} 2>&1 >/dev/null & + -f "${fullname}" -p ${port} 2>&1 >/dev/null & iipid=$! sleep 5 @@ -57,26 +56,26 @@ channels="$4" do kill -0 $iipid >/dev/null 2>&1 || exit 1 [ ! -f ${cfgbase}/running ] && exit 1 - sleep 2 + sleep 4 done # 433: Nickname is already in use. if [ -n "$(grep " 433 " ${ircbase}/${server}/out)" ]; then - exit 1 + exit 3 fi - #while [ -z "$(grep " 376 " ${ircbase}/${server}/out)" ]; - #do - # [ ! -f ${cfgbase}/running ] && exit 1 - # sleep 2 - #done - { - sleep 2 annna-join-channels "${server}" "${channels}" } & + # Check for end of motd. + while [ -z "$(grep " 376 " ${ircbase}/${server}/out)" ]; + do + [ ! -f ${cfgbase}/running ] && exit 1 + sleep 2 + done + # Watch for ii to exit. Then remove the used directory to have all # services disappear. while kill -0 $iipid >/dev/null 2>&1;