HUGE refactoring of call convention between scripts. - 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 21fb3dcd88a47fc4f38506131e22d601a86947de
DIR parent ff9d3c63deee7dbae89d954ba2fb03c89e419cd1
HTML Author: Annna Robert-Houdin <annna@bitreich.org>
Date: Mon, 13 Oct 2025 22:08:34 +0200
HUGE refactoring of call convention between scripts.
Diffstat:
M annna-alive | 4 ++--
M annna-channel-message | 25 +++++++------------------
M annna-channel-service | 38 +++++++++++++++----------------
M annna-join-channels | 35 ++++++++++++-------------------
M annna-message-common | 1299 +++++++++++++++----------------
D annna-message-gopherproject | 19 -------------------
M annna-message-radio | 59 ++++++++++++-------------------
M annna-message-sauna | 23 +++++------------------
M annna-message-wikigame | 35 +++++++++----------------------
M annna-say | 55 +++++++++++++------------------
A annna-sleeps | 13 +++++++++++++
M annna-start | 52 ++++++++++++++++++++++---------
D annna-start-main | 113 -------------------------------
A annna-start-server | 83 +++++++++++++++++++++++++++++++
M annna-start-service | 35 ++++++++++---------------------
M stable-diffusion-emoji | 2 --
16 files changed, 891 insertions(+), 999 deletions(-)
---
DIR diff --git a/annna-alive b/annna-alive
@@ -7,6 +7,6 @@
#
-[ -z "$(pgrep -U annna -x ii)" ] && exit 1
-exit 0
+[ -f "${ANNNA_BASE}/running" ] && exit 0
+exit 1
DIR diff --git a/annna-channel-message b/annna-channel-message
@@ -1,26 +1,15 @@
#!/bin/sh
-server="$1"
-channel="$2"
-user="$3"
-text="$4"
-cmd="$5"
+set -x
-cfgbase="$(pwd)"
-ircbase="$(cat ${cfgbase}/ircbase)"
-ircuser="$(cat ${cfgbase}/${server}/ircuser)"
-serverbase="${ircbase}/${server}"
-modbase="$(cat ${cfgbase}/modbase)"
-
-case "${channel}" in
-\#bitreich-radio) annna-message-radio "${server}" "${channel}" "${user}" "${text}" "${cmd}";;
-\#gopherproject) annna-message-gopherproject "${server}" "${channel}" "${user}" "${text}" "${cmd}";;
-\#bitreich-wikigame) annna-message-wikigame "${server}" "${channel}" "${user}" "${text}" "${cmd}";;
-\#bitreich-sauna) annna-message-sauna "${server}" "${channel}" "${user}" "${text}" "${cmd}";;
+case "${IRC_CHANNEL}" in
+\#bitreich-radio) annna-message-radio;;
+\#bitreich-wikigame) annna-message-wikigame;;
+\#bitreich-sauna) annna-message-sauna;;
\#bitreich-idle)
# This one runs its own daemon, so we have to give it a raw message. TODO: Fix
- [ "${cmd}" == "PRIVMSG" ] && printf "$(date +%s) <%s> %s\n" >> "${serverbase}/${channel}/out"
+ [ "${IRC_CMD}" == "PRIVMSG" ] && printf "$(date +%s) <%s> %s\n" "$IRC_USER" "$IRC_PRIVMSG_TEXT" >> "${IRC_SERVERBASE}/${IRC_CHANNEL}/out"
;;
-*) annna-message-common "${server}" "${channel}" "${user}" "${text}" "${cmd}";;
+*) annna-message-common;;
esac
DIR diff --git a/annna-channel-service b/annna-channel-service
@@ -1,35 +1,28 @@
#!/bin/sh
#
-# Per-channel daemon that monitors incoming messages from ii out script.
+# Per-IRC_CHANNEL daemon that monitors incoming messages from ii out script.
#
+set -x
+
pgrep -f "$0 $*" | grep -vxq "$$" && exec echo "$0 $* already running"
#trap 'exec pkill -U annna -f "entr .* ${PWD}/out"' INT TERM EXIT HUP
-server="$1"
-channel="$2"
-
-cfgbase="$(pwd)"
-ircbase="$(cat ${cfgbase}/ircbase)"
-ircuser="$(cat ${cfgbase}/${server}/ircuser)"
-serverbase="${ircbase}/${server}"
-modbase="$(cat ${cfgbase}/modbase)"
-
-case "${channel}" in
+case "${IRC_CHANNEL}" in
\#bitreich-idle)
- idlebase="${modbase}/idlerpg"
+ idlebase="${ANNNA_MODBASE}/idlerpg"
$idlebase/idlerpg-channel-service.py \
- "${ircuser}" "${idlebase}" "${ircbase}" "${server}" "${channel}" &
+ "${IRC_USER}" "${idlebase}" "${ANNNA_IRCBASE}" "${IRC_SERVER}" "${IRC_CHANNEL}" &
exit $?
;;
\#bitreich-radio)
- radiobase="${modbase}/radio"
+ radiobase="${ANNNA_MODBASE}/radio"
$radiobase/radio-channel-service.sh \
- "${ircuser}" "${radiobase}" "${ircbase}" "${server}" "${channel}" &
+ "${IRC_USER}" "${radiobase}" "${ANNNA_IRCBASE}" "${IRC_SERVER}" "${IRC_CHANNEL}" &
esac
-ls "${serverbase}/${channel}/out" \
- | entr tail -n 1 "${serverbase}/${channel}/out" 2>/dev/null \
+ls "${IRC_SERVERBASE}/${IRC_CHANNEL}/out" \
+ | entr tail -n 1 "${IRC_SERVERBASE}/${IRC_CHANNEL}/out" 2>/dev/null \
| {
while read -r line;
do
@@ -45,8 +38,10 @@ do
quit) cmd="QUIT";;
esac
[ -z "$cmd" ] && break
- user="$(printf "%s\n" "${line}" | cut -d' ' -f 3 | cut -d'(' -f 1)"
- annna-channel-message "${server}" "${channel}" "${user}" "" "${cmd}"
+ export IRC_CMD="${cmd}"
+ export IRC_CMD_USER="$(printf "%s\n" "${line}" | cut -d' ' -f 3 | cut -d'(' -f 1)"
+ export IRC_PRIVMSG_TEXT=""
+ annna-channel-message
;;
"<"*">")
cmd="PRIVMSG"
@@ -55,7 +50,10 @@ do
| {
while read -r user text;
do
- annna-channel-message "${server}" "${channel}" "${user}" "${text}" "${cmd}"
+ export IRC_PRIVMSG_TEXT="${text}"
+ export IRC_CMD="${cmd}"
+ export IRC_CMD_USER="${user}"
+ annna-channel-message
done
}
;;
DIR diff --git a/annna-join-channels b/annna-join-channels
@@ -1,55 +1,46 @@
#!/bin/sh
-export PATH="$PATH:/home/annna/bin"
-
-cfgbase="$(pwd)"
-ircbase="$(cat ${cfgbase}/ircbase)"
-
-server="$1"
-channels="$2"
-
-export ircuser="$(cat ${cfgbase}/${server}/ircuser 2>/dev/null)"
+set -x
maxretries=32
# Channels
-for chan in ${channels};
+for chan in ${IRC_CHANNELS};
do
- printf "/j %s\n" "${chan}" > ${ircbase}/${server}/in
-
- # Do not flood.
+ export IRC_CHANNEL="${chan}"
+ printf "/j %s\n" "${chan}" > "${IRC_SERVERBASE}/in"
sleep 1
## Make sure the pipes are there.
tries=0
- while [ ! -e "${ircbase}/${server}/${chan}/out" ];
+ while [ ! -e "${IRC_SERVERBASE}/${chan}/out" ];
do
- [ ! -f ${cfgbase}/running ] && exit 1
+ [ ! annna-alive ] && exit 1
tries=$(($tries + 1))
[ $tries -gt $maxretries ] && exit 1
sleep 1
done
tries=0
- while [ ! -e "${ircbase}/${server}/${chan}/in" ];
+ while [ ! -e "${IRC_SERVERBASE}/${chan}/in" ];
do
- [ ! -f ${cfgbase}/running ] && exit 1
+ [ ! annna-alive ] && exit 1
tries=$(($tries + 1))
[ $tries -gt $maxretries ] && exit 1
sleep 1
done
tries=0
- ## Check if we have joined and received the message from the server.
- while [ -z "$(cat ${ircbase}/${server}/${chan}/out \
+ ## Check if we have joined and received the message from the IRC_SERVER.
+ while [ -z "$(cat "${IRC_SERVERBASE}/${chan}/out" \
| head -n 1 \
- | grep ".* ${ircuser}.* ${chan}.*")" ];
+ | grep ".* ${IRC_USER}.* ${chan}.*")" ];
do
- [ ! -f ${cfgbase}/running ] && exit 1
+ [ ! annna-alive ] && exit 1
tries=$(($tries + 1))
[ $tries -gt $maxretries ] && exit 1
sleep 2
done
- annna-start-service "${server}" "${chan}"
+ annna-start-service
done
DIR diff --git a/annna-message-common b/annna-message-common
@@ -1,24 +1,20 @@
#!/bin/bash
-export PATH="/br/bin:$PATH"
+set -x
-cfgbase="$(pwd)"
-ircbase="$(cat ${cfgbase}/ircbase)"
-modbase="$(cat ${cfgbase}/modbase)"
-hashtagfile="${modbase}/hashtags/hashtags.txt"
-idontcaredb="${modbase}/i-dont-care/i-dont-care.txt"
+#printf "%s %s %s %s\n" "${0##*/}" "${IRC_CHANNEL}" "${IRC_CMD_USER}" "${IRC_PRIVMSG_TEXT}"
+
+[ "${IRC_CMD_USER}" = "${IRC_USER}" ] && exit 0
+[ -z "${IRC_PRIVMSG_TEXT}" ] && exit 0
+
+hashtagfile="${ANNNA_MODBASE}/hashtags/hashtags.txt"
+idontcaredb="${ANNNA_MODBASE}/i-dont-care/i-dont-care.txt"
printnhashtags=2
brmembers="__20h__ Evil_Bob chripo posativ quinq stateless solene josuah parazyd bin KatolaZ adc Athas ROYGBYTE"
referees="__20h__"
ignorednicks="eidolon"
linkbrotherchannels="#bitreich-meme"
-server="$1"
-ircuser="$(cat ${cfgbase}/${server}/ircuser)"
-channel="$2"
-user="$3"
-text="$4"
-cmd="$5"
annnasumerian="𒈹"
annnabirthday="1989-05-18"
@@ -37,10 +33,6 @@ regeximatch() {
printf '%s' "$1" | grep -i -E -q "$2"
}
-#printf "%s %s %s %s\n" "${0##*/}" "${channel}" "${user}" "${text}"
-
-[ "$user" = "${ircuser}" ] && exit 0
-
isignored=0
for ignorednick in $ignorednicks;
do
@@ -57,8 +49,7 @@ dospoil=0
# Expand meme hashtag and show recommendations.
doexpand=0
-[ -z "${text}" ] && exit 0
-case "${text}" in
+case "${IRC_PRIVMSG_TEXT}" in
*\#nospoil*)
nospoil=1
;;
@@ -68,37 +59,37 @@ case "${text}" in
*::*::*)
if [ $(pgrep -f stable-diffusion-emoji 2>/dev/null | wc -l) -gt 3 ];
then
- annna-say -s "${server}" -c "${channel}" "${user}, sorry, gophers://bitreich.org/I/memecache/bitreich-burning.png"
+ annna-say "${IRC_CMD_USER}, sorry, gophers://bitreich.org/I/memecache/bitreich-burning.png"
else
{
- query=${text#**::} query=${query%%::*}
+ query=${IRC_PRIVMSG_TEXT#**::} query=${query%%::*}
emojiuri="$(stable-diffusion-emoji "${query}")"
if [ -n "${emojiuri}" ];
then
- if [ -n "${user}" ] && [ "${user}" != "annna-cmd" ];
+ if [ -n "${IRC_CMD_USER}" ] && [ "${IRC_CMD_USER}" != "annna-cmd" ];
then
- annna-say -s "${server}" -c "${channel}" "${user}, ${emojiuri}"
+ annna-say "${IRC_CMD_USER}, ${emojiuri}"
else
- annna-say -s "${server}" -c "${channel}" "${emojiuri}"
+ annna-say "${emojiuri}"
fi
fi
} &
fi
;;
*http*://*|*ytdl://*)
- case "${text}" in
+ case "${IRC_PRIVMSG_TEXT}" in
*"#spoil"*)
dospoil=1
;;
esac
- case "${text}" in
+ case "${IRC_PRIVMSG_TEXT}" in
*http*://*)
- uri="$(printf "%s\n" "${text}" \
+ uri="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" \
| sed -n '/.*\(https\{0,1\}:\/\/[^ ]\{1,\}\).*/s//\1/p')"
;;
*ytdl://*)
- ytid="$(printf "%s\n" "${text}" \
+ ytid="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" \
| sed -n '/.*ytdl:\/\/\([^ ]\{1,\}\).*/s//\1/p')"
uri="$(printf "https://www.youtube.com/watch?v=%s" "${ytid}")"
;;
@@ -153,11 +144,11 @@ case "${text}" in
"")
;;
*Gunther*|*GUNTHER*|*Günther*|*GÜNTHER*)
- annna-say -s "${server}" -c "${channel}" "Oh Günther! ❤ ❤ ❤ ${urititle}"
+ annna-say "Oh Günther! ❤ ❤ ❤ ${urititle}"
uriexpansion=1
;;
*\|\ Cloudflare*|"Just a moment...")
- annna-say -s "${server}" -c "${channel}" "Mind your own business! We got clownflared: gophers://bitreich.org/0/ascii/clownflare.vt"
+ annna-say "Mind your own business! We got clownflared: gophers://bitreich.org/0/ascii/clownflare.vt"
titleend=1
uriexpansion=1
;;
@@ -333,7 +324,7 @@ case "${text}" in
[ -n "${urititle}" ] && outputstr="${outputstr} title: ${urititle} ;"
[ -n "${suri}" ] && outputstr="${outputstr} screen: ${suri} ;"
[ -n "${sturi}" ] && outputstr="${outputstr} subtitles: ${sturi} ;"
- annna-say -s "${server}" -c "${channel}" "${outputstr}"
+ annna-say "${outputstr}"
uriexpansion=1
fi
rm -f "${tmpf}"
@@ -343,164 +334,164 @@ esac
runlinkbrother=0
for linkbrotherchannel in $linkbrotherchannels;
do
- [ "$channel" = "$linkbrotherchannel" ] && runlinkbrother=1
+ [ "$IRC_CHANNEL" = "$linkbrotherchannel" ] && runlinkbrother=1
done
if [ $runlinkbrother -eq 1 ] && [ $nospoil -eq 0 ];
then
- critique=$($modbase/linkbrother/linkbrother.sh "$modbase/linkbrother/db" "$user" "$text")
+ critique=$($ANNNA_MODBASE/linkbrother/linkbrother.sh "$ANNNA_MODBASE/linkbrother/db" "${IRC_CMD_USER}" "${IRC_PRIVMSG_TEXT}")
if [ "$critique" ]; then
- annna-say -s "${server}" -c "${channel}" "$critique"
+ annna-say "$critique"
fi
fi
-case "${text}" in
-"${ircuser}"?)
- exclamation="$(printf "%s\n" "${text}" | sed "s,${ircuser}\(.\),\1,g")"
- exclamationsintime=$(exclamatio "${user}")
+case "${IRC_PRIVMSG_TEXT}" in
+"${IRC_USER}"?)
+ exclamation="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | sed "s,${IRC_USER}\(.\),\1,g")"
+ exclamationsintime=$(exclamatio "${IRC_CMD_USER}")
finalexclamation="${exclamation}"
while [ $exclamationsintime -gt 1 ];
do
finalexclamation="${finalexclamation}${exclamation}"
exclamationsintime=$(($exclamationsintime - 1))
done
- annna-say -s "${server}" -c "${channel}" "${user}${finalexclamation}"
+ annna-say "${IRC_CMD_USER}${finalexclamation}"
;;
-"${ircuser}, how old are you?")
+"${IRC_USER}, how old are you?")
age="$(ddiff ${annnabirthday} today -f "%y")"
- annna-say -s "${server}" -c "${channel}" "${user}, I am ${age} years old."
+ annna-say "${IRC_CMD_USER}, I am ${age} years old."
;;
-"${ircuser}, when is your birthday?")
- annna-say -s "${server}" -c "${channel}" "${user}, I am born on ${annnabirthday}."
+"${IRC_USER}, when is your birthday?")
+ annna-say "${IRC_CMD_USER}, I am born on ${annnabirthday}."
;;
-"${ircuser}, asl"*)
- annna-say -s "${server}" -c "${channel}" "${user}, age: born on 1989-05-18; sex: IRC bot; location: bitreich.org; u?"
+"${IRC_USER}, asl"*)
+ annna-say "${IRC_CMD_USER}, age: born on 1989-05-18; sex: IRC bot; location: bitreich.org; u?"
;;
-"${ircuser}, woop")
+"${IRC_USER}, woop")
# Using the same database for funny hacks.
- exclamation="$(printf "%s\n" "${text}" | sed "s;${ircuser}, \(.\);\1;g")"
- exclamationsintime=$(exclamatio "${user}")
+ exclamation="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | sed "s;${IRC_USER}, \(.\);\1;g")"
+ exclamationsintime=$(exclamatio "${IRC_CMD_USER}")
finalexclamation="${exclamation}"
while [ $exclamationsintime -gt 1 ];
do
finalexclamation="${finalexclamation} ${exclamation}"
exclamationsintime=$(($exclamationsintime - 1))
done
- annna-say -s "${server}" -c "${channel}" "${user}, ${finalexclamation}"
+ annna-say "${IRC_CMD_USER}, ${finalexclamation}"
;;
-"${ircuser}, hype")
+"${IRC_USER}, hype")
# Using the same database for funny hacks.
- exclamation="$(printf "%s\n" "${text}" | sed "s;${ircuser}, \(.\);\1;g")"
- exclamationsintime=$(exclamatio "${user}")
+ exclamation="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | sed "s;${IRC_USER}, \(.\);\1;g")"
+ exclamationsintime=$(exclamatio "${IRC_CMD_USER}")
finalexclamation="${exclamation}"
while [ $exclamationsintime -gt 1 ];
do
finalexclamation="${finalexclamation} ${exclamation}"
exclamationsintime=$(($exclamationsintime - 1))
done
- annna-say -s "${server}" -c "${channel}" "${user}, ${finalexclamation}"
+ annna-say "${IRC_CMD_USER}, ${finalexclamation}"
;;
*">:3"*)
- annna-say -s "${server}" -c "${channel}" "OMG IT'S A LION GET IN THE CAR!"
+ annna-say "OMG IT'S A LION GET IN THE CAR!"
;;
*"<3"*)
- love "${user}++"
- annna-say -s "${server}" -c "${channel}" "*o.o*"
+ love "${IRC_CMD_USER}++"
+ annna-say "*o.o*"
;;
*"m(")
- annna-say -s "${server}" -c "${channel}" "(-‸ლ)"
+ annna-say "(-‸ლ)"
;;
*"*shrug*"*)
- annna-say -s "${server}" -c "${channel}" "¯\\_(ツ)_/¯"
+ annna-say "¯\\_(ツ)_/¯"
;;
*"*glare*"*)
- annna-say -s "${server}" -c "${channel}" "ಠ_ಠ"
+ annna-say "ಠ_ಠ"
;;
*"*finger*"*)
- annna-say -s "${server}" -c "${channel}" "╭∩╮(ಠ_ಠ)╭∩╮"
+ annna-say "╭∩╮(ಠ_ಠ)╭∩╮"
;;
*"*yolo*"*)
- annna-say -s "${server}" -c "${channel}" "Yᵒᵘ Oᶰˡʸ Lᶤᵛᵉ Oᶰᶜᵉ"
+ annna-say "Yᵒᵘ Oᶰˡʸ Lᶤᵛᵉ Oᶰᶜᵉ"
;;
*":'(")
- annna-say -s "${server}" -c "${channel}" "(╯︵╰,)"
+ annna-say "(╯︵╰,)"
;;
-"Thanks ${ircuser}"*)
- annna-say -s "${server}" -c "${channel}" "${user}, you are welcome."
+"Thanks ${IRC_USER}"*)
+ annna-say "${IRC_CMD_USER}, you are welcome."
;;
*" ope sorry"*|"ope sorry"*)
- annna-say -s "${server}" -c "${channel}" "${user}, 😃pe sorry."
+ annna-say "${IRC_CMD_USER}, 😃pe sorry."
;;
-"${ircuser}, snake.")
- annna-say -s "${server}" -c "${channel}" "${user}, ssSSsSssSssSsssssSSsSSSSsSssSSSSsssSSSSsssSSsssSssssSssssSSssSSsSssssSSsSSssSsssSssSSSS"
+"${IRC_USER}, snake.")
+ annna-say "${IRC_CMD_USER}, ssSSsSssSssSsssssSSsSSSSsSssSSSSsssSSSSsssSSsssSssssSssssSSssSSsSssssSSsSSssSsssSssSSSS"
;;
-"${ircuser}, snoke.")
- annna-say -s "${server}" -c "${channel}" "${user}, snoke again?"
+"${IRC_USER}, snoke.")
+ annna-say "${IRC_CMD_USER}, snoke again?"
;;
-"${ircuser}, amirite?")
- annna-say -s "${server}" -c "${channel}" "${user}, Yep, you're the most correct of them all."
+"${IRC_USER}, amirite?")
+ annna-say "${IRC_CMD_USER}, Yep, you're the most correct of them all."
;;
-"${ircuser}, ping.")
- annna-say -s "${server}" -c "${channel}" "${user}, pong."
+"${IRC_USER}, ping.")
+ annna-say "${IRC_CMD_USER}, pong."
;;
-"${ircuser}, how lame is my nick?")
- lamenessstr="$(lameness "${user}")"
- annna-say -s "${server}" -c "${channel}" "${lamenessstr}"
+"${IRC_USER}, how lame is my nick?")
+ lamenessstr="$(lameness "${IRC_CMD_USER}")"
+ annna-say "${lamenessstr}"
;;
-"${ircuser}, ding.")
- annna-say -s "${server}" -c "${channel}" "${user}, dong."
+"${IRC_USER}, ding.")
+ annna-say "${IRC_CMD_USER}, dong."
;;
-"${ircuser}, irly"*)
- annna-say -s "${server}" -c "${channel}" "${user}, I love you too."
+"${IRC_USER}, irly"*)
+ annna-say "${IRC_CMD_USER}, I love you too."
;;
-"${ircuser}, bleep bloop.")
- annna-say -s "${server}" -c "${channel}" "${user}, bloop bleep."
+"${IRC_USER}, bleep bloop.")
+ annna-say "${IRC_CMD_USER}, bloop bleep."
;;
-"${ircuser}, snare.")
- annna-say -s "${server}" -c "${channel}" "${user}, not snare again!"
+"${IRC_USER}, snare.")
+ annna-say "${IRC_CMD_USER}, not snare again!"
;;
-"${ircuser}, I am mad.")
- annna-say -s "${server}" -c "${channel}" "${user}, we have a MAD SCIENTIST ONBOARD :>"
+"${IRC_USER}, I am mad.")
+ annna-say "${IRC_CMD_USER}, we have a MAD SCIENTIST ONBOARD :>"
;;
-"${ircuser}, I am holy.")
- annna-say -s "${server}" -c "${channel}" "${user}, Holy shit this guy is totally NUTS!!!"
+"${IRC_USER}, I am holy.")
+ annna-say "${IRC_CMD_USER}, Holy shit this guy is totally NUTS!!!"
;;
-"${ircuser}, please compliment me.")
- annna-say -s "${server}" -c "${channel}" "${user}, you rock!"
+"${IRC_USER}, please compliment me.")
+ annna-say "${IRC_CMD_USER}, you rock!"
;;
-"${ircuser}, what the karma?")
- annna-say -s "${server}" -c "${channel}" "${user}, gophers://bitreich.org/1/irc/karma"
+"${IRC_USER}, what the karma?")
+ annna-say "${IRC_CMD_USER}, gophers://bitreich.org/1/irc/karma"
;;
-"${ircuser}, who is lovely?")
- annna-say -s "${server}" -c "${channel}" "${user}, gophers://bitreich.org/1/irc/love"
+"${IRC_USER}, who is lovely?")
+ annna-say "${IRC_CMD_USER}, gophers://bitreich.org/1/irc/love"
;;
-"${ircuser}, what the brcon score?")
- annna-say -s "${server}" -c "${channel}" "${user}, gophers://bitreich.org/1/con/$(date +%Y)/score"
+"${IRC_USER}, what the brcon score?")
+ annna-say "${IRC_CMD_USER}, gophers://bitreich.org/1/con/$(date +%Y)/score"
;;
-"${ircuser}, what the shame?")
- annna-say -s "${server}" -c "${channel}" "${user}, gophers://bitreich.org/1/irc/shame"
+"${IRC_USER}, what the shame?")
+ annna-say "${IRC_CMD_USER}, gophers://bitreich.org/1/irc/shame"
;;
-"${ircuser}, please generate a password for me.")
+"${IRC_USER}, please generate a password for me.")
newpws="$(pwgen -B1ny 20 10 | paste -sd ' ')"
- annna-say -s "${server}" -c "${channel}" "${user}, as you wish: ${newpws}"
+ annna-say "${IRC_CMD_USER}, as you wish: ${newpws}"
;;
*"don't care"*)
dontcaresay="$(shuf -n 1 ${idontcaredb})"
- annna-say -s "${server}" -c "${channel}" "${user}, ${dontcaresay}"
+ annna-say "${IRC_CMD_USER}, ${dontcaresay}"
;;
-"${ircuser}, how can I phlog on bitreich?")
- 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"
+"${IRC_USER}, how can I phlog on bitreich?")
+ annna-say "${IRC_CMD_USER}, please read: gophers://bitreich.org/0/usr/20h/phlog/2017-08-26T20-04-02-482296.md and gophers://bitreich.org/0/usr/20h/phlog/2017-08-26T20-27-40-281825.md"
;;
-"${ircuser}, what's my type?")
+"${IRC_USER}, what's my type?")
{
cd /br/gopher
usertype="$(find memecache/type-?.png -type f \
| shuf -n 1 \
| xargs -n 1 printf "gophers://bitreich.org/9%s\n")"
- annna-say -s "${server}" -c "${channel}" "${user}, your type is ${usertype}"
+ annna-say "${IRC_CMD_USER}, your type is ${usertype}"
}
;;
-"${ircuser}, please show me a video about "*)
- word="$(printf "%s\n" "${text}" | cut -c 37-)"
+"${IRC_USER}, please show me a video about "*)
+ word="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -c 37-)"
case "$word" in
*\?)
word="$(printf "%s\n" "${word}" | cut -c -"$((${#word} - 1))")"
@@ -509,20 +500,20 @@ case "${text}" in
videoresult="$(idiotbox-roulette "${word}")"
if [ -n "${videoresult}" ];
then
- annna-say -s "${server}" -c "${channel}" "${user}, ${videoresult}"
+ annna-say "${IRC_CMD_USER}, ${videoresult}"
else
- annna-say -s "${server}" -c "${channel}" "${user}, sorry, nothing founds."
+ annna-say "${IRC_CMD_USER}, sorry, nothing founds."
fi
;;
-"${ircuser}, what is my fortune?")
+"${IRC_USER}, what is my fortune?")
fortunecookie="$(fortune-cookie)"
if [ -n "${fortunecookie}" ];
then
- annna-say -s "${server}" -c "${channel}" "${user}, ${fortunecookie}"
+ annna-say "${IRC_CMD_USER}, ${fortunecookie}"
fi
;;
-"${ircuser}, what is "*)
- word="$(printf "%s\n" "${text}" | cut -c 16-)"
+"${IRC_USER}, what is "*)
+ word="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -c 16-)"
case "$word" in
*\?)
word="$(printf "%s\n" "${word}" | cut -c -"$((${#word} - 1))")"
@@ -549,129 +540,129 @@ case "${text}" in
else
puri="$(printf "%s\n" "${dresult}" | /br/bin/bitreich-paste)"
fi
- annna-say -s "${server}" -c "${channel}" "${puri}"
+ annna-say "${puri}"
;;
-"${ircuser}, cowsay "*)
- word="$(printf "%s\n" "${text}" | cut -c 15-)"
+"${IRC_USER}, cowsay "*)
+ word="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -c 15-)"
tmpf=$(mktemp)
if cowsayasaservice ${word} > ${tmpf}; then
curi="$(/br/bin/bitreich-paste < ${tmpf})"
- annna-say -s "${server}" -c "${channel}" "${user}: the cow said... ${curi}"
+ annna-say "${IRC_CMD_USER}: the cow said... ${curi}"
fi
rm ${tmpf} 2>/dev/null
;;
-"${ircuser}, please give me the unix power.")
+"${IRC_USER}, please give me the unix power.")
upcuri="$(unix-power)"
if [ -n "${upcuri}" ];
then
- annna-say -s "${server}" -c "${channel}" "${user}, ${upcuri}"
+ annna-say "${IRC_CMD_USER}, ${upcuri}"
fi
;;
-"${ircuser}, please stop the last emoji prompt.")
+"${IRC_USER}, please stop the last emoji prompt.")
lastemojipromptpid="$(pgrep -f stable-diffusion-emoji | sort -n | tail -n 1)"
if [ -n "${lastemojipromptpid}" ];
then
pstree -A -p "${lastemojipromptpid}" | grep -Eow "[0-9]+" | xargs kill
- annna-say -s "${server}" -c "${channel}" "${user}, I HUPed ${lastemojipromptpid} and all its children for you."
+ annna-say "${IRC_CMD_USER}, I HUPed ${lastemojipromptpid} and all its children for you."
else
- annna-say -s "${server}" -c "${channel}" "${user}, sorry, no instances found."
+ annna-say "${IRC_CMD_USER}, sorry, no instances found."
fi
;;
-"${ircuser}, play despacito plz.")
- annna-say -s "${server}" -c "${channel}" "${user}, gophers://bitreich.org/9/memecache/despacito.mkv"
+"${IRC_USER}, play despacito plz.")
+ annna-say "${IRC_CMD_USER}, gophers://bitreich.org/9/memecache/despacito.mkv"
;;
-"nice to meet you ${ircuser}"*)
- annna-say -s "${server}" -c "${channel}" "${user}, the pleasure is on my side. :-)"
+"nice to meet you ${IRC_USER}"*)
+ annna-say "${IRC_CMD_USER}, the pleasure is on my side. :-)"
;;
-"${ircuser}, please give me a Chuck Norris fact.")
+"${IRC_USER}, please give me a Chuck Norris fact.")
chuck=$(chucknorris)
- annna-say -s "${server}" -c "${channel}" "${user}, ${chuck}"
+ annna-say "${IRC_CMD_USER}, ${chuck}"
;;
-"${ircuser}, magic.")
+"${IRC_USER}, magic.")
magictrick="$(magic)"
if [ -n "${magictrick}" ];
then
- annna-say -s "${server}" -c "${channel}" "${user}, ${magictrick}"
+ annna-say "${IRC_CMD_USER}, ${magictrick}"
fi
;;
-"${ircuser}, please show me ip art.")
- annna-say -s "${server}" -c "${channel}" "${user}, please see #bitreich-tv for the magic."
+"${IRC_USER}, please show me ip art.")
+ annna-say "${IRC_CMD_USER}, please see #bitreich-tv for the magic."
{
cd $HOME/bin/modules/ip-art;
# Lock, so only one annna process manipulates eth0.
flock $HOME/bin/modules/ip-art -c "./display-file.sh ip-art.ipart"
} &
;;
-"${ircuser}, I feel button.")
+"${IRC_USER}, I feel button.")
buri="$(button-gen)"
if [ -n "${buri}" ];
then
- annna-say -s "${server}" -c "${channel}" "${user}, like this? ${buri}"
+ annna-say "${IRC_CMD_USER}, like this? ${buri}"
else
- annna-say -s "${server}" -c "${channel}" "${user}, sorry, no feelings for you today."
+ annna-say "${IRC_CMD_USER}, sorry, no feelings for you today."
fi
;;
-"${ircuser}, I feel stupid.")
+"${IRC_USER}, I feel stupid.")
nuri=$(darwin)
tmpf=$(mktemp)
fetch-uri "${nuri}" > "${tmpf}"
curi="$(9 htmlfmt < "${tmpf}" | /br/bin/bitreich-paste)"
- annna-say -s "${server}" -c "${channel}" "${user}, do not feel stupid, others are more stupid: ${curi}"
+ annna-say "${IRC_CMD_USER}, do not feel stupid, others are more stupid: ${curi}"
rm ${tmpf} 2>/dev/null
;;
-"${ircuser}, I feel down.")
+"${IRC_USER}, 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}"
+ annna-say "${IRC_CMD_USER}, do not feel bad, others had worse days: ${postmortem}"
;;
-"${ircuser}, I feel perl.")
+"${IRC_USER}, I feel perl.")
perlfeelings="$(perl-feelings)"
if [ -n "${perl-feelings}" ];
then
- annna-say -s "${server}" -c "${channel}" "${user}, I feel ${perlfeelings}"
+ annna-say "${IRC_CMD_USER}, I feel ${perlfeelings}"
fi
;;
-"${ircuser}, will you be my girlfriend?")
+"${IRC_USER}, will you be my girlfriend?")
rejection="$(girlfriend)"
- annna-say -s "${server}" -c "${channel}" "${user}, ${rejection}"
+ annna-say "${IRC_CMD_USER}, ${rejection}"
;;
-"${ircuser}, who fights crime?"|"${ircuser}, who is fighting crime?")
+"${IRC_USER}, who fights crime?"|"${IRC_USER}, 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}"
+ crimefighter="$(theyfightcrime ${IRC_CMD_USER} ${partner})"
+ annna-say "${crimefighter}"
;;
-"${ircuser}, please give me a commit message.")
+"${IRC_USER}, please give me a commit message.")
commitmsg="$(whatthecommit)"
- annna-say -s "${server}" -c "${channel}" "${commitmsg}"
+ annna-say "${commitmsg}"
;;
-"${ircuser}, please paint the irc channel.")
- emojiuri="$(emoji-channel-history "${ircbase}/${server}/${channel}")"
+"${IRC_USER}, please paint the irc channel.")
+ emojiuri="$(emoji-channel-history "${ANNNA_IRCBASE}/${IRC_SERVER}/${IRC_CHANNEL}")"
if [ -n "${emojiuri}" ];
then
- annna-say -s "${server}" -c "${channel}" "${emojiuri}"
+ annna-say "${emojiuri}"
fi
;;
-"${ircuser}, birp.")
+"${IRC_USER}, birp.")
birdname="$(bird-name)"
- annna-say -s "${server}" -c "${channel}" "${user}, I heard a ${birdname} bird."
+ annna-say "${IRC_CMD_USER}, I heard a ${birdname} bird."
;;
-"${ircuser}, please oneline me.")
+"${IRC_USER}, please oneline me.")
randomoneliner="$(oneliner)"
if [ -z "${randomoneliner}" ];
then
- annna-say -s "${server}" -c "${channel}" "${user}, the service failed. Please redial to your BOL account."
+ annna-say "${IRC_CMD_USER}, the service failed. Please redial to your BOL account."
else
- annna-say -s "${server}" -c "${channel}" "${user}, ${randomoneliner}"
+ annna-say "${IRC_CMD_USER}, ${randomoneliner}"
fi
;;
*"what's app?")
maemoapp="$(whatsapp)"
if [ -n "${maemoapp}" ];
then
- annna-say -s "${server}" -c "${channel}" "Have you tried? ${maemoapp}"
+ annna-say "Have you tried? ${maemoapp}"
fi
;;
-"${ircuser}, man "*|"${ircuser}, man "*)
- exp="$(printf "%s\n" "${text}" | cut -c 12- | sed 's,\t, ,g')"
+"${IRC_USER}, man "*|"${IRC_USER}, man "*)
+ exp="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -c 12- | sed 's,\t, ,g')"
dresult="$(COLUMNS=80 man "${exp}" 2>/dev/null)"
if [ "$dresult" ];
@@ -681,77 +672,77 @@ case "${text}" in
puri="No matches found."
fi
- annna-say -s "${server}" -c "${channel}" "${puri}"
+ annna-say "${puri}"
;;
-"${ircuser}, please pray for me.")
- annna-say -s "${server}" -c "${channel}" "${user}, here, for you: gophers://bitreich.org/9/memecache/llaminim.mkv"
+"${IRC_USER}, please pray for me.")
+ annna-say "${IRC_CMD_USER}, here, for you: gophers://bitreich.org/9/memecache/llaminim.mkv"
;;
-"${ircuser}, nigger."|*nigger*|*NIGGER*)
+"${IRC_USER}, nigger."|*nigger*|*NIGGER*)
nword="$(n-word)"
- annna-say -s "${server}" -c "${channel}" "${user}, don't use the ${nword}!"
+ annna-say "${IRC_CMD_USER}, don't use the ${nword}!"
;;
-"${ircuser}, why was I breached?")
+"${IRC_USER}, why was I breached?")
breachtext="$(why-was-i-breached)"
if [ -n "${breachtext}" ];
then
- annna-say -s "${server}" -c "${channel}" "${user}, ${breachtext}"
+ annna-say "${IRC_CMD_USER}, ${breachtext}"
fi
;;
-"${ircuser}, please be responsible about "*)
- word="$(printf "%s\n" "${text}" | cut -c 36- | sed 's,\t, ,g')"
+"${IRC_USER}, please be responsible about "*)
+ word="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -c 36- | sed 's,\t, ,g')"
suri="$(responsibility "${word}" | bitreich-paste)"
- annna-say -s "${server}" -c "${channel}" "${suri}"
+ annna-say "${suri}"
;;
-"${ircuser}, please say "*)
- word="$(printf "%s\n" "${text}" | cut -c 19- | sed 's,\t, ,g')"
+"${IRC_USER}, please say "*)
+ word="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -c 19- | sed 's,\t, ,g')"
suri="$(printf "%s\n" "${word}" | bitreich-speak)"
- annna-say -s "${server}" -c "${channel}" "${suri}"
+ annna-say "${suri}"
;;
-"${ircuser}, please zombie say "*)
- word="$(printf "%s\n" "${text}" | cut -c 26- | sed 's,\t, ,g')"
+"${IRC_USER}, please zombie say "*)
+ word="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -c 26- | sed 's,\t, ,g')"
suri="$(printf "%s\n" "${word}" | zombie -e | bitreich-speak)"
- annna-say -s "${server}" -c "${channel}" "${suri}"
+ annna-say "${suri}"
;;
-"${ircuser}, please unzombie "*)
- word="$(printf "%s\n" "${text}" | cut -c 24- | sed 's,\t, ,g')"
+"${IRC_USER}, please unzombie "*)
+ word="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -c 24- | sed 's,\t, ,g')"
suri="$(printf "%s\n" "${word}" | zombie -d)"
- annna-say -s "${server}" -c "${channel}" "${suri}"
+ annna-say "${suri}"
;;
-"${ircuser}, please zombie "*)
- word="$(printf "%s\n" "${text}" | cut -c 22- | sed 's,\t, ,g')"
+"${IRC_USER}, please zombie "*)
+ word="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -c 22- | sed 's,\t, ,g')"
suri="$(printf "%s\n" "${word}" | zombie -e)"
- annna-say -s "${server}" -c "${channel}" "${suri}"
+ annna-say "${suri}"
;;
-"${ircuser}, please ghost say "*)
- word="$(printf "%s\n" "${text}" | cut -c 25- | sed 's,\t, ,g')"
+"${IRC_USER}, please ghost say "*)
+ word="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -c 25- | sed 's,\t, ,g')"
suri="$(printf "%s\n" "${word}" | ghost -e | bitreich-speak)"
- annna-say -s "${server}" -c "${channel}" "${suri}"
+ annna-say "${suri}"
;;
-"${ircuser}, please unghost "*)
- word="$(printf "%s\n" "${text}" | cut -c 23- | sed 's,\t, ,g')"
+"${IRC_USER}, please unghost "*)
+ word="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -c 23- | sed 's,\t, ,g')"
suri="$(printf "%s\n" "${word}" | ghost -d)"
- annna-say -s "${server}" -c "${channel}" "${suri}"
+ annna-say "${suri}"
;;
-"${ircuser}, please ghost "*)
- word="$(printf "%s\n" "${text}" | cut -c 21- | sed 's,\t, ,g')"
+"${IRC_USER}, please ghost "*)
+ word="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -c 21- | sed 's,\t, ,g')"
suri="$(printf "%s\n" "${word}" | ghost -e)"
- annna-say -s "${server}" -c "${channel}" "${suri}"
+ annna-say "${suri}"
;;
-"${ircuser}, please pohlish "*)
- word="$(printf "%s\n" "${text}" | cut -c 23- | sed 's,\t, ,g')"
+"${IRC_USER}, please pohlish "*)
+ word="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -c 23- | sed 's,\t, ,g')"
suri="$(pohlcode.awk "${word}" | head -n 1)"
- annna-say -s "${server}" -c "${channel}" "${suri}"
+ annna-say "${suri}"
;;
-"${ircuser}, please cunei "*)
- word="$(printf "%s\n" "${text}" | cut -c 21- | sed 's,\t, ,g')"
+"${IRC_USER}, please cunei "*)
+ word="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -c 21- | sed 's,\t, ,g')"
suri="$(int2cunei "${word}" | head -n 1)"
- annna-say -s "${server}" -c "${channel}" "${suri}"
+ annna-say "${suri}"
;;
-"${ircuser}, what is up with gopher man?")
+"${IRC_USER}, what is up with gopher man?")
# TODO
;;
-"${ircuser}, what can I cook with "*)
- ingredients="$(printf "%s\n" "${text}" | cut -c 29- | sed 's,\t, ,g')"
+"${IRC_USER}, what can I cook with "*)
+ ingredients="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -c 29- | sed 's,\t, ,g')"
case "$ingredients" in
*\?)
ingredients="$(printf "%s\n" "${ingredients}" | cut -c -"$(($(expr length "${ingredients}") - 1))")"
@@ -762,140 +753,140 @@ case "${text}" in
if [ -n "${results}" ];
then
puri="$(printf "%s\n" "${results}" | bitreich-paste | sed 's,0p,1p,')"
- annna-say -s "${server}" -c "${channel}" "${user}, here are some recipes: ${puri}"
+ annna-say "${IRC_CMD_USER}, here are some recipes: ${puri}"
else
gptchefrecipe="$(gpt-chef "${ingredients}")"
if [ -n "${gptchefrecipe}" ];
then
- annna-say -s "${server}" -c "${channel}" "${user}, there was no ready-made recipe, so maybe this is an idea: ${gptchefrecipe}"
+ annna-say "${IRC_CMD_USER}, there was no ready-made recipe, so maybe this is an idea: ${gptchefrecipe}"
if [ $(pgrep -f stable-diffusion-emoji 2>/dev/null | wc -l) -lt 3 ];
then
{
emojiuri="$(stable-diffusion-emoji "${gptchefrecipe}")"
if [ -n "${emojiuri}" ];
then
- annna-say -s "${server}" -c "${channel}" "${emojiuri}"
+ annna-say "${emojiuri}"
fi
} &
fi
else
- annna-say -s "${server}" -c "${channel}" "${user}, I could not find any recipes for you."
+ annna-say "${IRC_CMD_USER}, I could not find any recipes for you."
fi
fi
;;
-"${ircuser}, gpt "*)
+"${IRC_USER}, gpt "*)
# TODO: use modules/prompt-agents
- prompt="$(printf "%s\n" "${text}" | cut -c 12- | sed 's,\t, ,g')"
+ prompt="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -c 12- | sed 's,\t, ,g')"
{
- annna-say -s "${server}" -c "${channel}" "$(gpt "${prompt}. Please answer short and precise.")"
+ annna-say "$(gpt "${prompt}. Please answer short and precise.")"
} &
;;
"Preacher, "*|"preacher, "*)
personality="preacher"
- preprompt="$(cat ${modbase}/prompt-agents/${personality}.prompt.txt)"
- prompt="$(printf "%s\n" "${text}" | cut -d' ' -f 2- | sed 's,\t, ,g')"
+ preprompt="$(cat ${ANNNA_MODBASE}/prompt-agents/${personality}.prompt.txt)"
+ prompt="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -d' ' -f 2- | sed 's,\t, ,g')"
{
- annna-say -s "${server}" -c "${channel}" "$(gpt "System: ${preprompt}\n User: ${prompt}\n Bot:")"
+ annna-say "$(gpt "System: ${preprompt}\n User: ${prompt}\n Bot:")"
} &
;;
"Uplift, "*|"uplift, "*)
personality="uplifting"
- preprompt="$(cat ${modbase}/prompt-agents/${personality}.prompt.txt)"
- prompt="$(printf "%s\n" "${text}" | cut -d' ' -f 2- | sed 's,\t, ,g')"
+ preprompt="$(cat ${ANNNA_MODBASE}/prompt-agents/${personality}.prompt.txt)"
+ prompt="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -d' ' -f 2- | sed 's,\t, ,g')"
{
- annna-say -s "${server}" -c "${channel}" "$(gpt "System: ${preprompt}\n User: ${prompt}\n Bot:")"
+ annna-say "$(gpt "System: ${preprompt}\n User: ${prompt}\n Bot:")"
} &
;;
"Grumpy, "*|"grumpy, "*)
personality="grumpy-fart"
- preprompt="$(cat ${modbase}/prompt-agents/${personality}.prompt.txt)"
- prompt="$(printf "%s\n" "${text}" | cut -d' ' -f 2- | sed 's,\t, ,g')"
+ preprompt="$(cat ${ANNNA_MODBASE}/prompt-agents/${personality}.prompt.txt)"
+ prompt="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -d' ' -f 2- | sed 's,\t, ,g')"
{
- annna-say -s "${server}" -c "${channel}" "$(gpt "System: ${preprompt}\n User:${prompt}\n Bot:")"
+ annna-say "$(gpt "System: ${preprompt}\n User:${prompt}\n Bot:")"
} &
;;
"Santa, "*|"Sannnta, "*|"santa, "*|"sannnta, "*)
personality="santa"
- preprompt="$(cat ${modbase}/prompt-agents/${personality}.prompt.txt)"
- prompt="$(printf "%s\n" "${text}" | cut -d' ' -f 2- | sed 's,\t, ,g')"
+ preprompt="$(cat ${ANNNA_MODBASE}/prompt-agents/${personality}.prompt.txt)"
+ prompt="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -d' ' -f 2- | sed 's,\t, ,g')"
{
- annna-say -s "${server}" -c "${channel}" "$(gpt "System: ${preprompt}\n User: ${prompt}\n Bot:")"
+ annna-say "$(gpt "System: ${preprompt}\n User: ${prompt}\n Bot:")"
} &
;;
"Satan, "*|"Satannn, "*|"satan, "*|"satannn, "*)
personality="satan"
- preprompt="$(cat ${modbase}/prompt-agents/${personality}.prompt.txt)"
- prompt="$(printf "%s\n" "${text}" | cut -d' ' -f 2- | sed 's,\t, ,g')"
+ preprompt="$(cat ${ANNNA_MODBASE}/prompt-agents/${personality}.prompt.txt)"
+ prompt="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -d' ' -f 2- | sed 's,\t, ,g')"
{
- annna-say -s "${server}" -c "${channel}" "$(gpt "System: ${preprompt}\n User: ${prompt}\n Bot:")"
+ annna-say "$(gpt "System: ${preprompt}\n User: ${prompt}\n Bot:")"
} &
;;
"Trump, "*|"trump, "*)
personality="trump"
- preprompt="$(cat ${modbase}/prompt-agents/${personality}.prompt.txt)"
- prompt="$(printf "%s\n" "${text}" | cut -d' ' -f 2- | sed 's,\t, ,g')"
+ preprompt="$(cat ${ANNNA_MODBASE}/prompt-agents/${personality}.prompt.txt)"
+ prompt="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -d' ' -f 2- | sed 's,\t, ,g')"
{
- annna-say -s "${server}" -c "${channel}" "$(gpt "System: ${preprompt}\n User: ${prompt}\n Bot:")"
+ annna-say "$(gpt "System: ${preprompt}\n User: ${prompt}\n Bot:")"
} &
;;
"Freud, "*|"freud, "*|"Sigmund, "*|"sigmund, "*)
personality="sigmund-freud"
- preprompt="$(cat ${modbase}/prompt-agents/${personality}.prompt.txt)"
- prompt="$(printf "%s\n" "${text}" | cut -d' ' -f 2- | sed 's,\t, ,g')"
+ preprompt="$(cat ${ANNNA_MODBASE}/prompt-agents/${personality}.prompt.txt)"
+ prompt="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -d' ' -f 2- | sed 's,\t, ,g')"
{
- annna-say -s "${server}" -c "${channel}" "$(gpt "System: ${preprompt}\n User:${prompt}\n Bot:")"
+ annna-say "$(gpt "System: ${preprompt}\n User:${prompt}\n Bot:")"
} &
;;
"Mao, "*|"mao, "*)
personality="mao"
- preprompt="$(cat ${modbase}/prompt-agents/${personality}.prompt.txt)"
- prompt="$(printf "%s\n" "${text}" | cut -d' ' -f 2- | sed 's,\t, ,g')"
+ preprompt="$(cat ${ANNNA_MODBASE}/prompt-agents/${personality}.prompt.txt)"
+ prompt="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -d' ' -f 2- | sed 's,\t, ,g')"
{
- annna-say -s "${server}" -c "${channel}" "$(gpt "System: ${preprompt}\n User:${prompt}\n Bot:")"
+ annna-say "$(gpt "System: ${preprompt}\n User:${prompt}\n Bot:")"
} &
;;
"Teleromeo, "*|"teleromeo, "*)
personality="teleromeo"
- preprompt="$(cat ${modbase}/prompt-agents/${personality}.prompt.txt)"
- prompt="$(printf "%s\n" "${text}" | cut -d' ' -f 2- | sed 's,\t, ,g')"
+ preprompt="$(cat ${ANNNA_MODBASE}/prompt-agents/${personality}.prompt.txt)"
+ prompt="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -d' ' -f 2- | sed 's,\t, ,g')"
{
- annna-say -s "${server}" -c "${channel}" "$(gpt "System: ${preprompt}\n User:${prompt}\n Bot:")"
+ annna-say "$(gpt "System: ${preprompt}\n User:${prompt}\n Bot:")"
} &
;;
"Modem, "*|"modem, "*)
personality="modem"
- preprompt="$(cat ${modbase}/prompt-agents/${personality}.prompt.txt)"
- prompt="$(printf "%s\n" "${text}" | cut -d' ' -f 2- | sed 's,\t, ,g')"
+ preprompt="$(cat ${ANNNA_MODBASE}/prompt-agents/${personality}.prompt.txt)"
+ prompt="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -d' ' -f 2- | sed 's,\t, ,g')"
{
- annna-say -s "${server}" -c "${channel}" "$(gpt "System: ${preprompt}\n User: ${prompt}\n Bot:")"
+ annna-say "$(gpt "System: ${preprompt}\n User: ${prompt}\n Bot:")"
} &
;;
"Sadh_Guru, "*|"Sadh_guru, "*|"sadh_guru, "*|"sadh_Guru, "*)
personality="sadh_guru"
- preprompt="$(cat ${modbase}/prompt-agents/${personality}.prompt.txt)"
- prompt="$(printf "%s\n" "${text}" | cut -d' ' -f 2- | sed 's,\t, ,g')"
+ preprompt="$(cat ${ANNNA_MODBASE}/prompt-agents/${personality}.prompt.txt)"
+ prompt="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -d' ' -f 2- | sed 's,\t, ,g')"
{
- annna-say -s "${server}" -c "${channel}" "$(gpt "System: ${preprompt}\n User: ${prompt}\n Bot:")"
+ annna-say "$(gpt "System: ${preprompt}\n User: ${prompt}\n Bot:")"
} &
;;
"Prophet, "*|"prophet, "*)
personality="prophet"
- preprompt="$(cat ${modbase}/prompt-agents/${personality}.prompt.txt)"
- prompt="$(printf "%s\n" "${text}" | cut -d' ' -f 2- | sed 's,\t, ,g')"
+ preprompt="$(cat ${ANNNA_MODBASE}/prompt-agents/${personality}.prompt.txt)"
+ prompt="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -d' ' -f 2- | sed 's,\t, ,g')"
{
- annna-say -s "${server}" -c "${channel}" "$(gpt "System: ${preprompt}\n User: ${prompt}\n Bot:")"
+ annna-say "$(gpt "System: ${preprompt}\n User: ${prompt}\n Bot:")"
} &
;;
"Luther, "*|"luther, "*)
personality="luther"
- preprompt="$(cat ${modbase}/prompt-agents/${personality}.prompt.txt)"
- prompt="$(printf "%s\n" "${text}" | cut -d' ' -f 2- | sed 's,\t, ,g')"
+ preprompt="$(cat ${ANNNA_MODBASE}/prompt-agents/${personality}.prompt.txt)"
+ prompt="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -d' ' -f 2- | sed 's,\t, ,g')"
{
- annna-say -s "${server}" -c "${channel}" "$(gpt "System: ${preprompt}\n User: ${prompt}\n Bot:")"
+ annna-say "$(gpt "System: ${preprompt}\n User: ${prompt}\n Bot:")"
} &
;;
-"${ircuser}, wolfram is "*)
- word="$(printf "%s\n" "${text}" | cut -c 19- | sed 's,\t, ,g')"
+"${IRC_USER}, wolfram is "*)
+ word="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -c 19- | sed 's,\t, ,g')"
case "$word" in
*\?)
word="$(printf "%s\n" "${word}" | cut -c -"$(($(expr length "${word}") - 1))")"
@@ -939,108 +930,108 @@ case "${text}" in
else
puri="No matches found."
fi
- annna-say -s "${server}" -c "${channel}" -- "${puri}"
+ annna-say -- "${puri}"
;;
-"${ircuser}, pray"*)
+"${IRC_USER}, 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"
+ annna-say "${IRC_CMD_USER}, I Obey my master! long live satan"
;;
-"${ircuser}, sacrifice"*)
+"${IRC_USER}, 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!"
+ annna-say "${IRC_CMD_USER}, Your word is my command, Power to satan!"
;;
-"${ircuser}, please scare me.")
+"${IRC_USER}, please scare me.")
{
- annna-say -s "${server}" -c "${channel}" "$(halloween)"
+ annna-say "$(halloween)"
} &
;;
-"${ircuser}, how drunk is "*)
+"${IRC_USER}, how drunk is "*)
{
- drunknick="$(printf "%s\n" "${text}" \
+ drunknick="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" \
| sed 's,.*how drunk is \(.*\),\1,' \
| tr -d '?')"
- drunkness="$(drunk-meter "${ircbase}/${server}/${channel}/out" "${drunknick}")"
+ drunkness="$(drunk-meter "${ANNNA_IRCBASE}/${IRC_SERVER}/${IRC_CHANNEL}/out" "${drunknick}")"
if [ -n "${drunkness}" ];
then
- annna-say -s "${server}" -c "${channel}" "${user}, ${drunknick} is ${drunkness} drunk."
+ annna-say "${IRC_CMD_USER}, ${drunknick} is ${drunkness} drunk."
fi
} &
;;
-"${ircuser}, how do I "*)
+"${IRC_USER}, how do I "*)
{
- gptprompt="$(printf "%s\n" "${text}" \
+ gptprompt="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" \
| sed 's,.*how do I \(.*\),\1,' \
| tr -d '?')"
gpturi="$(gpt "how do I ${gptprompt}" | bitreich-paste)"
if [ -n "${gpturi}" ];
then
- annna-say -s "${server}" -c "${channel}" "${user}, try this: ${gpturi}"
+ annna-say "${IRC_CMD_USER}, try this: ${gpturi}"
fi
} &
;;
-"${ircuser}, weather at "*|"${ircuser}, weather in "*)
+"${IRC_USER}, weather at "*|"${IRC_USER}, weather in "*)
{
- weatherplace="$(printf "%s\n" "${text}" \
+ weatherplace="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" \
| sed 's,.*weather .. \(.*\),\1,' \
| tr -d '?')"
if weathertext="$(weather "${weatherplace}")"
then
- annna-say -s "${server}" -c "${channel}" "${user}, the weather at ${weatherplace} is ${weathertext}"
+ annna-say "${IRC_CMD_USER}, the weather at ${weatherplace} is ${weathertext}"
else
- annna-say -s "${server}" -c "${channel}" "${user}, there is no weather at ${weatherplace}."
+ annna-say "${IRC_CMD_USER}, there is no weather at ${weatherplace}."
fi
} &
;;
-"${ircuser}, funny weather at "*|"${ircuser}, funny weather in "*)
+"${IRC_USER}, funny weather at "*|"${IRC_USER}, funny weather in "*)
{
- weatherplace="$(printf "%s\n" "${text}" \
+ weatherplace="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" \
| sed 's,.*funny weather .. \(.*\),\1,' \
| tr -d '?')"
personality="funny-weather-reporter"
- preprompt="$(cat ${modbase}/prompt-agents/${personality}.prompt.txt)"
+ preprompt="$(cat ${ANNNA_MODBASE}/prompt-agents/${personality}.prompt.txt)"
if weathertext="$(weather "${weatherplace}")"
then
prompt="$(printf "%s\n" "${weathertext}" | cut -d' ' -f 2- | sed 's,\t, ,g')"
{
- annna-say -s "${server}" -c "${channel}" "${user}, $(gpt "System: ${preprompt}\n User: ${prompt}\n Bot:")"
+ annna-say "${IRC_CMD_USER}, $(gpt "System: ${preprompt}\n User: ${prompt}\n Bot:")"
} &
else
weathertext="there is no weather at ${weatherplace}"
prompt="${weathertext}"
{
- annna-say -s "${server}" -c "${channel}" "${user}, $(gpt "System: ${preprompt}\n User: ${prompt}\n Bot:")"
+ annna-say "${IRC_CMD_USER}, $(gpt "System: ${preprompt}\n User: ${prompt}\n Bot:")"
} &
fi
} &
;;
-"${ircuser}, color weather at "*|"${ircuser}, color weather in "*)
+"${IRC_USER}, color weather at "*|"${IRC_USER}, color weather in "*)
{
- weatherplace="$(printf "%s\n" "${text}" \
+ weatherplace="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" \
| sed 's,.*color weather .. \(.*\),\1,' \
| tr -d '?')"
personality="color-weather-reporter"
- preprompt="$(cat ${modbase}/prompt-agents/${personality}.prompt.txt)"
+ preprompt="$(cat ${ANNNA_MODBASE}/prompt-agents/${personality}.prompt.txt)"
if weathertext="$(weather "${weatherplace}")"
then
prompt="$(printf "%s\n" "${weathertext}" | cut -d' ' -f 2- | sed 's,\t, ,g')"
{
- annna-say -s "${server}" -c "${channel}" "${user}, $(gpt "System:${preprompt}\nUser:${prompt}\nBot:")"
+ annna-say "${IRC_CMD_USER}, $(gpt "System:${preprompt}\nUser:${prompt}\nBot:")"
} &
else
weathertext="there is no weather at ${weatherplace}"
prompt="${weathertext}"
{
- annna-say -s "${server}" -c "${channel}" "${user}, $(gpt "System:${preprompt}\nUser:${prompt}\nBot:")"
+ annna-say "${IRC_CMD_USER}, $(gpt "System:${preprompt}\nUser:${prompt}\nBot:")"
} &
fi
} &
;;
-"${ircuser}, METAR for "*|"${ircuser}, metar for "*|"${ircuser}, metar for "*|"${ircuser}, METAR for "*)
- resp=$(metar "$(printf '%.4s\n' "${text##* }")")
- annna-say -s "${server}" -c "${channel}" "${user}, ${resp}"
+"${IRC_USER}, METAR for "*|"${IRC_USER}, metar for "*|"${IRC_USER}, metar for "*|"${IRC_USER}, METAR for "*)
+ resp=$(metar "$(printf '%.4s\n' "${IRC_PRIVMSG_TEXT##* }")")
+ annna-say "${IRC_CMD_USER}, ${resp}"
;;
-"${ircuser}, how discriminating is "*)
- word="$(printf "%s\n" "${text}" | cut -c 30- | sed 's,\t, ,g')"
+"${IRC_USER}, how discriminating is "*)
+ word="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -c 30- | sed 's,\t, ,g')"
case "$word" in
*\?)
word="$(printf "%s\n" "${word}" | cut -c -"$(($(expr length "${word}") - 1))")"
@@ -1050,114 +1041,114 @@ case "${text}" in
newword="$(discrimination-filter "${word}")"
if [ "${newword}" = "${word}" ];
then
- annna-say -s "${server}" -c "${channel}" "${user}, it is ok."
+ annna-say "${IRC_CMD_USER}, it is ok."
else
- annna-say -s "${server}" -c "${channel}" "${user}, it should be: ${newword}"
+ annna-say "${IRC_CMD_USER}, it should be: ${newword}"
fi
;;
-"${ircuser}, are "*)
- case "${text}" in
+"${IRC_USER}, are "*)
+ case "${IRC_PRIVMSG_TEXT}" in
*" in love?")
- words="$(printf "%s\n" "${text}" | sed 's,.*are \(.*\) and \(.*\) in love?,\1 \2,')"
+ words="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | sed 's,.*are \(.*\) and \(.*\) in love?,\1 \2,')"
lovedistance="$(printf "%s * 100\n" "$(fstrcmp ${words})" | bc | cut -d'.' -f 1)"
if [ $lovedistance -gt 15 ];
then
- annna-say -s "${server}" -c "${channel}" 'Yes!!! Pure <3 <3'
+ annna-say 'Yes!!! Pure <3 <3'
else
- annna-say -s "${server}" -c "${channel}" "No."
+ annna-say "No."
fi
;;
esac
;;
-"${ircuser}, is "*)
- aitext="$(printf "%s\n" "${text}" | cut -c 7- | sed 's,\t, ,g')"
+"${IRC_USER}, is "*)
+ aitext="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -c 7- | sed 's,\t, ,g')"
airesult="$(printf "%s\n" "${aitext}" | josuah-ai)"
if [ -n "${airesult}" ];
then
- annna-say -s "${server}" -c "${channel}" "${user},${airesult}"
+ annna-say "${IRC_CMD_USER},${airesult}"
fi
;;
-"Ok, ${ircuser}"*)
- annna-say -s "${server}" -c "${channel}" "${user}, I am not a consumer device."
+"Ok, ${IRC_USER}"*)
+ annna-say "${IRC_CMD_USER}, I am not a consumer device."
;;
-"ok, ${ircuser}"*)
- annna-say -s "${server}" -c "${channel}" "${user}, I am not a consumer device."
+"ok, ${IRC_USER}"*)
+ annna-say "${IRC_CMD_USER}, I am not a consumer device."
;;
-"${ircuser}, please shoot "*|"${ircuser}, plese shoot "*)
- word="$(printf "%s\n" "${text}" | cut -c 21-)"
- annna-say -s "${server}" -c "${channel}" "${word}, #pewpew gophers://bitreich.org/9/memecache/pewpew.mp4"
+"${IRC_USER}, please shoot "*|"${IRC_USER}, plese shoot "*)
+ word="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -c 21-)"
+ annna-say "${word}, #pewpew gophers://bitreich.org/9/memecache/pewpew.mp4"
;;
-"${ircuser}, please quinq.")
- annna-say -s "${server}" -c "${channel}" "┻━┻ ︵╰(°□°)╯︵ ┻━┻"
+"${IRC_USER}, please quinq.")
+ annna-say "┻━┻ ︵╰(°□°)╯︵ ┻━┻"
;;
-"${ircuser}, please flip "*)
- word="$(printf "%s\n" "${text}" | cut -c 20-)"
+"${IRC_USER}, please flip "*)
+ word="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -c 20-)"
updownword="$(updown "${word}")"
- annna-say -s "${server}" -c "${channel}" "(╯°□°)╯ ${word} ︵ ${updownword}"
+ annna-say "(╯°□°)╯ ${word} ︵ ${updownword}"
;;
-"${ircuser}, please crystal math "*)
- math="$(printf "%s\n" "${text}" | cut -c 28-)"
+"${IRC_USER}, please crystal math "*)
+ math="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -c 28-)"
crystaluri="$(crystal-math "${math}")"
- annna-say -s "${server}" -c "${channel}" "${user}, please see ${crystaluri}"
+ annna-say "${IRC_CMD_USER}, please see ${crystaluri}"
;;
-"${ircuser}, please australize "*)
- word="$(printf "%s\n" "${text}" | cut -c 26-)"
+"${IRC_USER}, please australize "*)
+ word="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -c 26-)"
updownword="$(updown "${word}")"
- annna-say -s "${server}" -c "${channel}" "${word} -> ${updownword}"
+ annna-say "${word} -> ${updownword}"
;;
-"${ircuser}, wtf "*)
- word="$(printf "%s\n" "${text}" | cut -c 11-)"
+"${IRC_USER}, wtf "*)
+ word="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -c 11-)"
wtfword="$(wtf "${word}" 2>/dev/null)"
if [ -n "${wtfword}" ];
then
- annna-say -s "${server}" -c "${channel}" "${user}, ${wtfword}"
+ annna-say "${IRC_CMD_USER}, ${wtfword}"
fi
;;
-"${ircuser}, please give me a good band name.")
+"${IRC_USER}, please give me a good band name.")
bandname="$(bandname-gen | shuf | head -n 1)"
- annna-say -s "${server}" -c "${channel}" "${bandname}"
+ annna-say "${bandname}"
;;
-"${ircuser}, I feel conspicuous.")
+"${IRC_USER}, I feel conspicuous.")
manifestouri="$(manifesto-gen | bitreich-paste)"
- annna-say -s "${server}" -c "${channel}" "Maybe declare this: ${manifestouri}"
+ annna-say "Maybe declare this: ${manifestouri}"
;;
-"${ircuser}, I am horny.")
+"${IRC_USER}, I am horny.")
essaypaste="$(bithub-gen)"
- annna-say -s "${server}" -c "${channel}" \
+ annna-say \
"Here is some intellectual porn for you: ${essaypaste}"
;;
-"${ircuser}, please turn on "*)
- word="$(printf "%s\n" "${text}" | cut -c 22-)"
- annna-say -s "${server}" -c "${channel}" "☞ ⏻ ${word}"
+"${IRC_USER}, please turn on "*)
+ word="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -c 22-)"
+ annna-say "☞ ⏻ ${word}"
;;
-"${ircuser}, please turn me on.")
- annna-say -s "${server}" -c "${channel}" "☞ ⏻ ${user}"
+"${IRC_USER}, please turn me on.")
+ annna-say "☞ ⏻ ${IRC_CMD_USER}"
;;
-"${ircuser}, I'm game bored.")
+"${IRC_USER}, I'm game bored.")
gamelink="$(abandonware-random-game)"
if [ -z "${gamelink}" ];
then
- annna-say -s "${server}" -c "${channel}" "${user}, sorry I have found nothing for you."
+ annna-say "${IRC_CMD_USER}, sorry I have found nothing for you."
else
- annna-say -s "${server}" -c "${channel}" "${user}, have you tried ${gamelink} ?"
+ annna-say "${IRC_CMD_USER}, have you tried ${gamelink} ?"
fi
;;
-"${ircuser}, I need a waifu.")
+"${IRC_USER}, I need a waifu.")
waifuuris="$(waifu-gen)"
if [ -n "${waifuuris}" ];
then
- annna-say -s "${server}" -c "${channel}" "${user}, ${waifuuris}"
+ annna-say "${IRC_CMD_USER}, ${waifuuris}"
fi
;;
-"${ircuser}, I need an anime.")
+"${IRC_USER}, I need an anime.")
animeuri="$(anime-gen)"
if [ -n "${animeuri}" ];
then
- annna-say -s "${server}" -c "${channel}" "${user}, ${animeuri}"
+ annna-say "${IRC_CMD_USER}, ${animeuri}"
fi
;;
-"${ircuser}, I'm gopher bored.")
+"${IRC_USER}, 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)"
@@ -1173,129 +1164,129 @@ case "${text}" in
then
outtext="$(printf "%s/%s%s" "$outtext" "$linktype" "$linksel")"
fi
- annna-say -s "${server}" -c "${channel}" "$outtext"
+ annna-say "$outtext"
;;
-"${ircuser}, wb.")
- annna-say -s "${server}" -c "${channel}" "${user}, ty! I am so happy to be here. :)"
+"${IRC_USER}, wb.")
+ annna-say "${IRC_CMD_USER}, ty! I am so happy to be here. :)"
;;
-"${ircuser}, I love you!")
- annna-say -s "${server}" -c "${channel}" $'\001ACTION blushes\001'
+"${IRC_USER}, I love you!")
+ annna-say $'\001ACTION blushes\001'
;;
-"${ircuser}, bon"*)
+"${IRC_USER}, bon"*)
insult="$(bonjour)"
- annna-say -s "${server}" -c "${channel}" "${user}, ${insult} !"
+ annna-say "${IRC_CMD_USER}, ${insult} !"
;;
-"${ircuser}, salut"*)
- annna-say -s "${server}" -c "${channel}" "${user}, Salutations camarade !"
+"${IRC_USER}, salut"*)
+ annna-say "${IRC_CMD_USER}, Salutations camarade !"
;;
-"${ircuser}, welcome back.")
- annna-say -s "${server}" -c "${channel}" "${user}, thank you! I am so happy to be here. :)"
+"${IRC_USER}, welcome back.")
+ annna-say "${IRC_CMD_USER}, thank you! I am so happy to be here. :)"
;;
-"${ircuser}, what's up?")
+"${IRC_USER}, what's up?")
newsstr="$(ecl -shell /home/solene/gopher/bin/generator.lisp)"
- annna-say -s "${server}" -c "${channel}" "$newsstr"
+ annna-say "$newsstr"
;;
-"${ircuser}, what's down?")
- annna-say -s "${server}" -c "${channel}" "${user}, we all love you."
+"${IRC_USER}, what's down?")
+ annna-say "${IRC_CMD_USER}, we all love you."
;;
*"ACTION cancels "*)
- mobtarget="$(printf "%s\n" "${text}" | sed 's,.*ACTION cancels \(.*\)\x01,\1,')"
+ mobtarget="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | sed 's,.*ACTION cancels \(.*\)\x01,\1,')"
cancel-target "${mobtarget}"
- annna-say -s "${server}" -c "${channel}" "${user}, I cancelled ${mobtarget} for you. ( gophers://bitreich.org/I/memecache/cancel-meteor.jpg )"
+ annna-say "${IRC_CMD_USER}, I cancelled ${mobtarget} for you. ( gophers://bitreich.org/I/memecache/cancel-meteor.jpg )"
;;
-*"ACTION pokes ${ircuser}"*)
- annna-say -s "${server}" -c "${channel}" "$(echo -e '\001')ACTION pokes ${user}$(echo -e '\001')"
+*"ACTION pokes ${IRC_USER}"*)
+ annna-say "$(echo -e '\001')ACTION pokes ${IRC_CMD_USER}$(echo -e '\001')"
;;
-"${ircuser}, please show me the mob"*|"${ircuser}, what are the mob"*)
+"${IRC_USER}, please show me the mob"*|"${IRC_USER}, what are the mob"*)
canceluri="$(get-cancel-list)"
- annna-say -s "${server}" -c "${channel}" "${user}, ${canceluri}"
+ annna-say "${IRC_CMD_USER}, ${canceluri}"
;;
-"${ircuser}, I feel sick.")
+"${IRC_USER}, I feel sick.")
newsstr="$(cd /br/gopher/hypochondria && ./hypochondria -s random)"
- annna-say -s "${server}" -c "${channel}" "You could have ${newsstr}! Be careful!"
+ annna-say "You could have ${newsstr}! Be careful!"
;;
*"oh hai"*|*"ohai"*|*"ohhai"*)
- annna-say -s "${server}" -c "${channel}" "${user}, hai! How is your sex life?"
+ annna-say "${IRC_CMD_USER}, hai! How is your sex life?"
;;
"o/"|"o/ "*|"\o"|"\o "*|"o7"|"o7 "*)
- annna-say -s "${server}" -c "${channel}" "${user}, ${text}"
+ annna-say "${IRC_CMD_USER}, ${IRC_PRIVMSG_TEXT}"
;;
"\m/"|"\m/ "*)
- annna-say -s "${server}" -c "${channel}" "${user}, ᕦ(ò_óˇ)ᕤ"
+ annna-say "${IRC_CMD_USER}, ᕦ(ò_óˇ)ᕤ"
;;
*"*waves*"*|*"*wave*"*)
- annna-say -s "${server}" -c "${channel}" "${user}, *wave*"
+ annna-say "${IRC_CMD_USER}, *wave*"
;;
"twtcs"*|"TWTCS"*)
- annna-say -s "${server}" -c "${channel}" "${user}, maybe: https://constitution.congress.gov/constitution/"
+ annna-say "${IRC_CMD_USER}, maybe: https://constitution.congress.gov/constitution/"
;;
"twss"*|"TWSS"*)
- annna-say -s "${server}" -c "${channel}" "${user}, no, I didn't."
+ annna-say "${IRC_CMD_USER}, no, I didn't."
;;
*"cows are nice"*)
- annna-say -s "${server}" -c "${channel}" "${user}, 'Cows are nice, unless you are a blade of grass.' -- Mr. Qi Ng (2023)"
+ annna-say "${IRC_CMD_USER}, 'Cows are nice, unless you are a blade of grass.' -- Mr. Qi Ng (2023)"
;;
-"${ircuser}, please make me a coffee.")
- annna-say -s "${server}" -c "${channel}" "${user}, ☕"
+"${IRC_USER}, please make me a coffee.")
+ annna-say "${IRC_CMD_USER}, ☕"
;;
-"${ircuser}, please tech hype me.")
+"${IRC_USER}, please tech hype me.")
techstr="$(tech-hype)"
- annna-say -s "${server}" -c "${channel}" "${techstr}"
+ annna-say "${techstr}"
;;
-"${ircuser}, please french hype me.")
+"${IRC_USER}, please french hype me.")
frenchstr="$(french-hype)"
- annna-say -s "${server}" -c "${channel}" "${frenchstr}"
+ annna-say "${frenchstr}"
;;
-"${ircuser}, please coffee read "*)
- readtarget="$(printf "%s\n" "${text}" | cut -c 27-)"
+"${IRC_USER}, please coffee read "*)
+ readtarget="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -c 27-)"
horostr="$($HOME/scm/bullshit/horoscope)"
- annna-say -s "${server}" -c "${channel}" "${readtarget}, ${horostr}"
+ annna-say "${readtarget}, ${horostr}"
;;
-"${ircuser}, what's my horoscope?")
+"${IRC_USER}, what's my horoscope?")
horostr="$($HOME/scm/bullshit/horoscope)"
- annna-say -s "${server}" -c "${channel}" "${user}, ${horostr}"
+ annna-say "${IRC_CMD_USER}, ${horostr}"
;;
-"${ircuser}, what should I cook"*)
+"${IRC_USER}, what should I cook"*)
recipestr="$(based.recipe)"
if [ -n "${recipestr}" ];
then
- annna-say -s "${server}" -c "${channel}" "${user}, ${recipestr}"
+ annna-say "${IRC_CMD_USER}, ${recipestr}"
else
gptchefrecipe="$(gpt-chef "something random")"
if [ -n "${gptchefrecipe}" ];
then
- annna-say -s "${server}" -c "${channel}" "${user}, ${gptchefrecipe}"
+ annna-say "${IRC_CMD_USER}, ${gptchefrecipe}"
if [ $(pgrep -f stable-diffusion-emoji 2>/dev/null | wc -l) -lt 3 ];
then
{
emojiuri="$(stable-diffusion-emoji "${gptchefrecipe}")"
if [ -n "${emojiuri}" ];
then
- annna-say -s "${server}" -c "${channel}" "${emojiuri}"
+ annna-say "${emojiuri}"
fi
} &
fi
else
- annna-say -s "${server}" -c "${channel}" "${user}, I have no recommendation for you today."
+ annna-say "${IRC_CMD_USER}, I have no recommendation for you today."
fi
fi
;;
# parazyd.org is unmaintained
-#"${ircuser}, what's my future?")
+#"${IRC_USER}, 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}"
+# annna-say "${IRC_CMD_USER}, your future is here: ${puri}"
# ;;
-"${ircuser}, haha.")
+"${IRC_USER}, haha.")
{
# Can take long, so run in background.
wuri="$(github-haha)"
if [ -n "${wuri}" ];
then
- annna-say -s "${server}" -c "${channel}" "${user}, haha ${wuri}"
+ annna-say "${IRC_CMD_USER}, haha ${wuri}"
fi
} &
;;
-"${ircuser}, meow"*)
+"${IRC_USER}, meow"*)
# https://catgps.wvd.io support
nmeows=$(($RANDOM % 14))
meows="Meow"
@@ -1309,144 +1300,144 @@ case "${text}" in
else
meows="$meows."
fi
- annna-say -s "${server}" -c "${channel}" "${user}, ${meows}"
+ annna-say "${IRC_CMD_USER}, ${meows}"
;;
-"${ircuser}, how many memes do you know?")
- annna-say -s "${server}" -c "${channel}" "I know $(hashtagcount) memes: gophers://bitreich.org/1/meme/count"
+"${IRC_USER}, how many memes do you know?")
+ annna-say "I know $(hashtagcount) memes: gophers://bitreich.org/1/meme/count"
;;
-"${ircuser}, how many people died of corona?")
- annna-say -s "${server}" -c "${channel}" "${user}, too many. :( Please see yourself: gopher://magical.fish/1/covid"
+"${IRC_USER}, how many people died of corona?")
+ annna-say "${IRC_CMD_USER}, too many. :( Please see yourself: gopher://magical.fish/1/covid"
;;
-"${ircuser}, please show me your memes.")
+"${IRC_USER}, please show me your memes.")
puri="$(printf "%s" "$(hashtags)" | /br/bin/bitreich-paste)"
- annna-say -s "${server}" -c "${channel}" "Here are my memes: ${puri}"
+ annna-say "Here are my memes: ${puri}"
;;
-"${ircuser}, please show me the victims.")
+"${IRC_USER}, 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}"
+ annna-say "Here are the victims: ${puri}"
;;
-"${ircuser}, please distro-hop with me.")
+"${IRC_USER}, 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} ?"
+ annna-say "How about https://distrowatch.com/${ndistro} ?"
;;
-"${ircuser}, please show me your Macron.")
- annna-say -s "${server}" -c "${channel}" "gophers://bitreich.org/0/ascii/macron.vt"
+"${IRC_USER}, please show me your Macron.")
+ annna-say "gophers://bitreich.org/0/ascii/macron.vt"
;;
-"${ircuser}, release the Kraken!")
- annna-say -s "${server}" -c "${channel}" "Here it is! gophers://bitreich.org/0/memecache/kraken.vt"
+"${IRC_USER}, release the Kraken!")
+ annna-say "Here it is! gophers://bitreich.org/0/memecache/kraken.vt"
;;
-"${ircuser}, where is your source?")
- annna-say -s "${server}" -c "${channel}" "Here is my precious source: git://bitreich.org/annna "
+"${IRC_USER}, where is your source?")
+ annna-say "Here is my precious source: git://bitreich.org/annna "
;;
-"${ircuser}, release the Quacken!")
- annna-say -s "${server}" -c "${channel}" "Quack Quack! gophers://bitreich.org/9/memecache/release-the-quacken.mkv"
+"${IRC_USER}, release the Quacken!")
+ annna-say "Quack Quack! gophers://bitreich.org/9/memecache/release-the-quacken.mkv"
;;
-"${ircuser}, be cool.")
+"${IRC_USER}, be cool.")
case "$(($RANDOM % 5))" in
0)
- annna-say -s "${server}" -c "${channel}" "(⌐■_■)"
+ annna-say "(⌐■_■)"
;;
1)
- annna-say -s "${server}" -c "${channel}" "(▰˘◡˘▰)"
+ annna-say "(▰˘◡˘▰)"
;;
2)
- annna-say -s "${server}" -c "${channel}" "(▀ Ĺ▀ )̄"
+ annna-say "(▀ Ĺ▀ )̄"
;;
3)
- annna-say -s "${server}" -c "${channel}" "(▀Ĺ▀ )"
+ annna-say "(▀Ĺ▀ )"
;;
*)
- annna-say -s "${server}" -c "${channel}" "I can't be cool! gophers://bitreich.org/9/memecache/i-cant-be-cool.mp3"
+ annna-say "I can't be cool! gophers://bitreich.org/9/memecache/i-cant-be-cool.mp3"
;;
esac
;;
-"${ircuser}, please cheer.")
+"${IRC_USER}, please cheer.")
case "$(($RANDOM % 2))" in
0)
- annna-say -s "${server}" -c "${channel}" '~\o/~'
+ annna-say '~\o/~'
;;
*)
- annna-say -s "${server}" -c "${channel}" '✺◟( ° ʖ °)◞✺'
+ annna-say '✺◟( ° ʖ °)◞✺'
;;
esac
;;
-"${ircuser}, please give me a fish.")
+"${IRC_USER}, please give me a fish.")
case "$(($RANDOM % 2))" in
0)
- annna-say -s "${server}" -c "${channel}" '<><'
+ annna-say '<><'
;;
*)
- annna-say -s "${server}" -c "${channel}" '><>'
+ annna-say '><>'
;;
esac
;;
-"${ircuser}, run.")
- annna-say -s "${server}" -c "${channel}" 'ᕕ(ಠ_ಠ)ᕗ'
+"${IRC_USER}, run.")
+ annna-say 'ᕕ(ಠ_ಠ)ᕗ'
;;
-"${ircuser}, be cute.")
+"${IRC_USER}, be cute.")
case "$(($RANDOM % 4))" in
0)
- annna-say -s "${server}" -c "${channel}" ' (\ /)'
+ annna-say ' (\ /)'
sleep 0.1
- annna-say -s "${server}" -c "${channel}" ' (. .)'
+ annna-say ' (. .)'
sleep 0.1
- annna-say -s "${server}" -c "${channel}" ' C(") (")'
+ annna-say ' C(") (")'
;;
1)
- annna-say -s "${server}" -c "${channel}" ' (\-/)'
+ annna-say ' (\-/)'
sleep 0.1
- annna-say -s "${server}" -c "${channel}" " (='.'=)"
+ annna-say " (='.'=)"
sleep 0.1
- annna-say -s "${server}" -c "${channel}" ' (")-(")o'
+ annna-say ' (")-(")o'
;;
2)
- annna-say -s "${server}" -c "${channel}" ' ( ) ( )'
+ annna-say ' ( ) ( )'
sleep 0.1
- annna-say -s "${server}" -c "${channel}" ' (>•.•<)'
+ annna-say ' (>•.•<)'
sleep 0.1
- annna-say -s "${server}" -c "${channel}" ' (") (")'
+ annna-say ' (") (")'
;;
*)
- annna-say -s "${server}" -c "${channel}" ' (\ (\'
+ annna-say ' (\ (\'
sleep 0.1
- annna-say -s "${server}" -c "${channel}" " (=' :')"
+ annna-say " (=' :')"
sleep 0.1
- annna-say -s "${server}" -c "${channel}" ' (, (") (")'
+ annna-say ' (, (") (")'
;;
esac
;;
-"${ircuser}, 8ball "*)
+"${IRC_USER}, 8ball "*)
eightballanswer="$(8ball)"
if [ -n "${eightballanswer}" ];
then
- annna-say -s "${server}" -c "${channel}" "${eightballanswer}"
+ annna-say "${eightballanswer}"
fi
;;
-"${ircuser}, email "*)
- findsyou="$(shuf -n 1 "${modbase}/finds-you/finds_you.txt")"
+"${IRC_USER}, email "*)
+ findsyou="$(shuf -n 1 "${ANNNA_MODBASE}/finds-you/finds_you.txt")"
if [ -n "${findsyou}" ];
then
- annna-say -s "${server}" -c "${channel}" "${user}, I hope this email ${findsyou}"
+ annna-say "${IRC_CMD_USER}, I hope this email ${findsyou}"
fi
;;
-"${ircuser}, please throw a coin for me.")
+"${IRC_USER}, please throw a coin for me.")
case "$((($RANDOM % 2) + 1))" in
1)
- annna-say -s "${server}" -c "${channel}" "face"
+ annna-say "face"
;;
2)
- annna-say -s "${server}" -c "${channel}" "number"
+ annna-say "number"
;;
esac
;;
-"${ircuser}, please quantum roll d2 for me.")
+"${IRC_USER}, please quantum roll d2 for me.")
qroll="$(($(/home/20h/scm/quantum-rng/quantum-rng) + 1))"
- annna-say -s "${server}" -c "${channel}" "${user}, ${qroll} [1d2(scores:[${qroll}])]"
+ annna-say "${IRC_CMD_USER}, ${qroll} [1d2(scores:[${qroll}])]"
;;
-"${ircuser}, please roll "*" for me.")
+"${IRC_USER}, please roll "*" for me.")
q="${text#* roll }"
q="${q%for*}"
@@ -1457,139 +1448,139 @@ case "${text}" in
[ "${q}" = "dice " ] && q="d6"
dicescore="$(dice "${q}")"
- annna-say -s "${server}" -c "${channel}" "${user}, ${dicescore}"
+ annna-say "${IRC_CMD_USER}, ${dicescore}"
;;
-"${ircuser}, please tell me your favourite flower.")
- annna-say -s "${server}" -c "${channel}" "My favourite flower is the beer flower."
+"${IRC_USER}, please tell me your favourite flower.")
+ annna-say "My favourite flower is the beer flower."
;;
-"${ircuser}, please tell me your favourite color.")
- annna-say -s "${server}" -c "${channel}" "My favourite color is yellow."
+"${IRC_USER}, please tell me your favourite color.")
+ annna-say "My favourite color is yellow."
;;
-"${ircuser}, please clap for me.")
- annna-say -s "${server}" -c "${channel}" "${user}, *clap* *clap* *clap*"
+"${IRC_USER}, please clap for me.")
+ annna-say "${IRC_CMD_USER}, *clap* *clap* *clap*"
;;
-"${ircuser}, which city does not exist?")
+"${IRC_USER}, which city does not exist?")
cityuri="$(this-city-does-not-exist)"
if [ -n "${cityuri}" ];
then
- annna-say -s "${server}" -c "${channel}" "${user}, this one: ${cityuri}"
+ annna-say "${IRC_CMD_USER}, this one: ${cityuri}"
else
- annna-say -s "${server}" -c "${channel}" "${user}, none."
+ annna-say "${IRC_CMD_USER}, none."
fi
;;
"For humanity!")
- annna-say -s "${server}" -c "${channel}" "${user}, for humanity! gophers://bitreich.org/0/memecache/annna-rchism.txt"
+ annna-say "${IRC_CMD_USER}, for humanity! gophers://bitreich.org/0/memecache/annna-rchism.txt"
;;
"Hack the planet!")
- annna-say -s "${server}" -c "${channel}" "${user}, hack the planet!"
+ annna-say "${IRC_CMD_USER}, hack the planet!"
;;
"Long live gopher!")
- annna-say -s "${server}" -c "${channel}" "${user}, long live gopher!"
+ annna-say "${IRC_CMD_USER}, long live gopher!"
;;
":)"|":))"|":)))"|":-)"|":-))"|":-)))"|":--)"|":--))"|":--)))"|":---)"|":----)"|"llol"|"lllol")
smileface="$(smile)"
- annna-say -s "${server}" -c "${channel}" -- "${smileface}"
+ annna-say -- "${smileface}"
;;
-"${ircuser}, please dance."|"\\o/"|"\^o^/")
+"${IRC_USER}, please dance."|"\\o/"|"\^o^/")
dancemoves="$(dance-moves-gen)"
- annna-say -s "${server}" -c "${channel}" -- "${dancemoves}"
+ annna-say -- "${dancemoves}"
;;
-"${ircuser}, let us celebrate!"|"/o/"|"\o\\")
+"${IRC_USER}, let us celebrate!"|"/o/"|"\o\\")
dancemoves="$(dance-moves-gen -m)"
- annna-say -s "${server}" -c "${channel}" -- "${dancemoves}"
+ annna-say -- "${dancemoves}"
;;
-"${ircuser}, please egyptian dance."|"${ircuser}, let us egyptian celebrate!"|"~o~"|"|o|")
+"${IRC_USER}, please egyptian dance."|"${IRC_USER}, let us egyptian celebrate!"|"~o~"|"|o|")
dancemoves="$(dance-moves-gen -e)"
- annna-say -s "${server}" -c "${channel}" -- "${dancemoves}"
+ annna-say -- "${dancemoves}"
;;
-"${ircuser}, please stamp this letter for me.")
- annna-say -s "${server}" -c "${channel}" -- "${user}, here: 🖃 "
+"${IRC_USER}, please stamp this letter for me.")
+ annna-say -- "${IRC_CMD_USER}, here: 🖃 "
;;
-"${ircuser}, please do the graveyard smash.")
- annna-say -s "${server}" -c "${channel}" -- "( つ ・ᴗ・)つ"
- annna-say -s "${server}" -c "${channel}" -- "ς ( ・ᴗ・ ς )"
- annna-say -s "${server}" -c "${channel}" -- "It did the mash\\ It did the ~~MONSTER MASH~~\\ It was a smash\\ It was a ~~GRAVEYARD SMASH~~"
+"${IRC_USER}, please do the graveyard smash.")
+ annna-say -- "( つ ・ᴗ・)つ"
+ annna-say -- "ς ( ・ᴗ・ ς )"
+ annna-say -- "It did the mash\\ It did the ~~MONSTER MASH~~\\ It was a smash\\ It was a ~~GRAVEYARD SMASH~~"
;;
-"${ircuser}, boo."|"${ircuser}, boo!")
- annna-say -s "${server}" -c "${channel}" "${user}, 👻"
+"${IRC_USER}, boo."|"${IRC_USER}, boo!")
+ annna-say "${IRC_CMD_USER}, 👻"
;;
-"${ircuser}, W3C."|"${ircuser}, w3c.")
- annna-say -s "${server}" -c "${channel}" "${user}, 🕸️ 🕷️ 🕸️"
+"${IRC_USER}, W3C."|"${IRC_USER}, w3c.")
+ annna-say "${IRC_CMD_USER}, 🕸️ 🕷️ 🕸️"
;;
-"${ircuser}, pumpkin.")
- annna-say -s "${server}" -c "${channel}" "${user}, 🎃"
+"${IRC_USER}, pumpkin.")
+ annna-say "${IRC_CMD_USER}, 🎃"
;;
-"${ircuser}, trick or treat"*|"${ircuser}, treat or trick"*)
- annna-say -s "${server}" -c "${channel}" "Wait for it. Old annnama is searching ..."
+"${IRC_USER}, trick or treat"*|"${IRC_USER}, treat or trick"*)
+ annna-say "Wait for it. Old annnama is searching ..."
{
sleeptime="$(( $RANDOM % 120 + 10 ))"
if [ $sleeptime -gt 60 ];
then
sleep "$(( $RANDOM % 30 + 20 ))"
- annna-say -s "${server}" -c "${channel}" "${user}, *swish* *swish* old annnama is still searching."
+ annna-say "${IRC_CMD_USER}, *swish* *swish* old annnama is still searching."
sleeptime="$(( $RANDOM % 60 + 10 ))"
fi
sleep $sleeptime
- annna-say -s "${server}" -c "${channel}" "${user}, $(trick-or-treat)"
+ annna-say "${IRC_CMD_USER}, $(trick-or-treat)"
} &
;;
-"${ircuser}, please dance with me.")
+"${IRC_USER}, please dance with me.")
if [ $(($RANDOM % 2)) -gt 0 ];
then
- annna-say -s "${server}" -c "${channel}" "I am not that kind of woman."
+ annna-say "I am not that kind of woman."
else
- annna-say -s "${server}" -c "${channel}" "Thank you! Let us dance! :-D"
+ annna-say "Thank you! Let us dance! :-D"
fi
;;
-"${ircuser}, please tell me who is your favourite pleasure man.")
- annna-say -s "${server}" -c "${channel}" "My favourite pleasure man is of course Gunther!"
+"${IRC_USER}, please tell me who is your favourite pleasure man.")
+ annna-say "My favourite pleasure man is of course Gunther!"
;;
-"${ircuser}, make me a sandwich"*)
- annna-say -s "${server}" -c "${channel}" "No."
+"${IRC_USER}, make me a sandwich"*)
+ annna-say "No."
;;
-"${ircuser}, sudo make me a sandwich"*)
- annna-say -s "${server}" -c "${channel}" "Humans are no objects."
+"${IRC_USER}, sudo make me a sandwich"*)
+ annna-say "Humans are no objects."
;;
-"${ircuser}, please make me a sandwich"*)
- annna-say -s "${server}" -c "${channel}" "Maybe."
+"${IRC_USER}, please make me a sandwich"*)
+ annna-say "Maybe."
;;
-"${ircuser}, sudo please make me a sandwich"*)
- annna-say -s "${server}" -c "${channel}" "Here is your sandwich."
+"${IRC_USER}, sudo please make me a sandwich"*)
+ annna-say "Here is your sandwich."
;;
-"${ircuser}, I feel unsure about my health.")
+"${IRC_USER}, I feel unsure about my health.")
healthadvice="$(health-advice)"
if [ -n "${healthadvice}" ];
then
- annna-say -s "${server}" -c "${channel}" "${user}, ${healthadvice}"
+ annna-say "${IRC_CMD_USER}, ${healthadvice}"
fi
;;
-"${ircuser}, bonjour !")
- annna-say -s "${server}" -c "${channel}" "${user}, bonjour !"
+"${IRC_USER}, bonjour !")
+ annna-say "${IRC_CMD_USER}, bonjour !"
;;
-*" pets ${ircuser}"*)
- annna-say -s "${server}" -c "${channel}" "${user}, *brrrrr*"
+*" pets ${IRC_USER}"*)
+ annna-say "${IRC_CMD_USER}, *brrrrr*"
;;
-"${ircuser}, please give me a penis extension.")
- annna-say -s "${server}" -c "${channel}" "${user}, here: $(penis-extension)"
+"${IRC_USER}, please give me a penis extension.")
+ annna-say "${IRC_CMD_USER}, here: $(penis-extension)"
;;
-"${ircuser}, please bobbitize me.")
- annna-say -s "${server}" -c "${channel}" "${user}, here: $(bobbitize)"
+"${IRC_USER}, please bobbitize me.")
+ annna-say "${IRC_CMD_USER}, here: $(bobbitize)"
;;
-"${ircuser}, please give me a baguette extension.")
- annna-say -s "${server}" -c "${channel}" "${user}, here: $(baguette-extension)"
+"${IRC_USER}, please give me a baguette extension.")
+ annna-say "${IRC_CMD_USER}, here: $(baguette-extension)"
;;
-"${ircuser}, please give me an allah extension.")
- annna-say -s "${server}" -c "${channel}" "${user}, here: $(allah-extension)"
+"${IRC_USER}, please give me an allah extension.")
+ annna-say "${IRC_CMD_USER}, here: $(allah-extension)"
;;
-"${ircuser}, please pull my finger.")
- annna-say -s "${server}" -c "${channel}" "${user}, you are disgusting."
+"${IRC_USER}, please pull my finger.")
+ annna-say "${IRC_CMD_USER}, you are disgusting."
;;
-"${ircuser}, what's up in Japan?")
- annna-say -s "${server}" -c "${channel}" "${user}, see for yourself: https://nhk3.mov3.co/hls/nhk.m3u8"
+"${IRC_USER}, what's up in Japan?")
+ annna-say "${IRC_CMD_USER}, see for yourself: https://nhk3.mov3.co/hls/nhk.m3u8"
;;
-"${ircuser}, please mqtt"*)
- mqtturi="$(printf '%s\n' "${text}" | cut -d' ' -f 3)"
+"${IRC_USER}, please mqtt"*)
+ mqtturi="$(printf '%s\n' "${IRC_PRIVMSG_TEXT}" | cut -d' ' -f 3)"
case "${mqtturi}" in
mqtt:*)
#mqtt:// full URI specified
@@ -1599,91 +1590,91 @@ case "${text}" in
mqtturi="mqtts://bitreich:oogui3queex&o9zaekah@bitreich.org/${mqtturi#mqtt}"
;;
esac
- msg="$(printf "%s\n" "${text}" | cut -d' ' -f 4-)"
+ msg="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -d' ' -f 4-)"
printf "${msg}\n" | mosquitto_pub -L "${mqtturi}" -l
;;
*"zuckerberg"*|*"Zuckerberg"*)
- annna-say -s "${server}" -c "${channel}" "${user}, did you mean gophers://bitreich.org/9/memecache/mark-suckerberg.mp4 ?"
+ annna-say "${IRC_CMD_USER}, did you mean gophers://bitreich.org/9/memecache/mark-suckerberg.mp4 ?"
;;
-"${ircuser}, please pick one of: "*)
- pick="$(printf '%s\n' "${text}" \
+"${IRC_USER}, please pick one of: "*)
+ pick="$(printf '%s\n' "${IRC_PRIVMSG_TEXT}" \
| sed 's/.*please pick one of: //' \
| tr ',' '\n' \
| tr -d ' ' \
| sort -R \
| head -n 1)"
- annna-say -s "${server}" -c "${channel}" "${user}, I think ${pick} is the best option."
+ annna-say "${IRC_CMD_USER}, I think ${pick} is the best option."
;;
-"${ircuser}, please play some Bach"*)
+"${IRC_USER}, please play some Bach"*)
midifile="$(find . /home/annna/bin/modules/midi-media/bach -name '*.mid' \
| sort -R \
| head -n 1)"
outfile="/br/gopher/midi/${midifile##*/}.ogg"
if midi-play "$midifile" >"$outfile"; then
- annna-say -s "${server}" -c "${channel}" "${user}, gophers://bitreich.org/9/midi/${outfile##*/}"
+ annna-say "${IRC_CMD_USER}, gophers://bitreich.org/9/midi/${outfile##*/}"
fi
;;
-"${ircuser}, please antidepressant #"*|\
-"${ircuser}, please amplify #"*|\
-"${ircuser}, please amsterdamify #"*|\
-"${ircuser}, please banjo #"*|\
-"${ircuser}, please bounce #"*|\
-"${ircuser}, please breakingnews #"*|\
-"${ircuser}, please celtify #"*|\
-"${ircuser}, please concatenate #"*|\
-"${ircuser}, please crimetv #"*|\
-"${ircuser}, please curb #"*|\
-"${ircuser}, please daybowbow #"*|\
-"${ircuser}, please deathmetal #"*|\
-"${ircuser}, please developers #"*|\
-"${ircuser}, please dontdoit #"*|\
-"${ircuser}, please dontsaytoyourmother #"*|\
-"${ircuser}, please doomify #"*|\
-"${ircuser}, please dutchapprove #"*|\
-"${ircuser}, please french #"*|\
-"${ircuser}, please FRENCH #"*|\
-"${ircuser}, please imam #"*|\
-"${ircuser}, please lop #"*|\
-"${ircuser}, please loop #"*|\
-"${ircuser}, please looop #"*|\
-"${ircuser}, please loooop #"*|\
-"${ircuser}, please mow #"*|\
-"${ircuser}, please namflashback #"*|\
-"${ircuser}, please news #"*|\
-"${ircuser}, please pullmyfinger #"*|\
-"${ircuser}, please putin #"*|\
-"${ircuser}, please reverse #"*|\
-"${ircuser}, please richardstrauss #"*|\
-"${ircuser}, please ritual #"*|\
-"${ircuser}, please sadviolin #"*|\
-"${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 tshirt #"*|\
-"${ircuser}, please trumpapprove #"*|\
-"${ircuser}, please USAUSA #"*|\
-"${ircuser}, please USA #"*|\
-"${ircuser}, please usa #"*|\
-"${ircuser}, please wat #"*|\
-"${ircuser}, please widen #"*|\
-"${ircuser}, please ww1 #"*|\
-"${ircuser}, please yellow #"*|\
-"${ircuser}, please zucc #"*|\
-"${ircuser}, please random #"*)
- hashtag="$(printf "%s\n" "${text}" | sed 's/.*#//; s/ .*//' )"
- recipient="$(printf "%s\n" "${text}" | sed 's/.* for //' )"
+"${IRC_USER}, please antidepressant #"*|\
+"${IRC_USER}, please amplify #"*|\
+"${IRC_USER}, please amsterdamify #"*|\
+"${IRC_USER}, please banjo #"*|\
+"${IRC_USER}, please bounce #"*|\
+"${IRC_USER}, please breakingnews #"*|\
+"${IRC_USER}, please celtify #"*|\
+"${IRC_USER}, please concatenate #"*|\
+"${IRC_USER}, please crimetv #"*|\
+"${IRC_USER}, please curb #"*|\
+"${IRC_USER}, please daybowbow #"*|\
+"${IRC_USER}, please deathmetal #"*|\
+"${IRC_USER}, please developers #"*|\
+"${IRC_USER}, please dontdoit #"*|\
+"${IRC_USER}, please dontsaytoyourmother #"*|\
+"${IRC_USER}, please doomify #"*|\
+"${IRC_USER}, please dutchapprove #"*|\
+"${IRC_USER}, please french #"*|\
+"${IRC_USER}, please FRENCH #"*|\
+"${IRC_USER}, please imam #"*|\
+"${IRC_USER}, please lop #"*|\
+"${IRC_USER}, please loop #"*|\
+"${IRC_USER}, please looop #"*|\
+"${IRC_USER}, please loooop #"*|\
+"${IRC_USER}, please mow #"*|\
+"${IRC_USER}, please namflashback #"*|\
+"${IRC_USER}, please news #"*|\
+"${IRC_USER}, please pullmyfinger #"*|\
+"${IRC_USER}, please putin #"*|\
+"${IRC_USER}, please reverse #"*|\
+"${IRC_USER}, please richardstrauss #"*|\
+"${IRC_USER}, please ritual #"*|\
+"${IRC_USER}, please sadviolin #"*|\
+"${IRC_USER}, please science #"*|\
+"${IRC_USER}, please scrollify #"*|\
+"${IRC_USER}, please sendtohell #"*|\
+"${IRC_USER}, please sexify #"*|\
+"${IRC_USER}, please slavify #"*|\
+"${IRC_USER}, please slowdown #"*|\
+"${IRC_USER}, please smith #"*|\
+"${IRC_USER}, please speedup #"*|\
+"${IRC_USER}, please techno #"*|\
+"${IRC_USER}, please technodrugs #"*|\
+"${IRC_USER}, please thin #"*|\
+"${IRC_USER}, please torture #"*|\
+"${IRC_USER}, please tshirt #"*|\
+"${IRC_USER}, please trumpapprove #"*|\
+"${IRC_USER}, please USAUSA #"*|\
+"${IRC_USER}, please USA #"*|\
+"${IRC_USER}, please usa #"*|\
+"${IRC_USER}, please wat #"*|\
+"${IRC_USER}, please widen #"*|\
+"${IRC_USER}, please ww1 #"*|\
+"${IRC_USER}, please yellow #"*|\
+"${IRC_USER}, please zucc #"*|\
+"${IRC_USER}, please random #"*)
+ hashtag="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | sed 's/.*#//; s/ .*//' )"
+ recipient="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | sed 's/.* for //' )"
origext="$(grep -E "^#${hashtag} " "${hashtagfile}" | sed 's/.*\.//')"
{
- filter="$(printf '%s\n' "${text}" | cut -d' ' -f3)"
+ filter="$(printf '%s\n' "${IRC_PRIVMSG_TEXT}" | cut -d' ' -f3)"
if [ "${filter}" = "random" ];
then
filters=("antidepressant" "amplify" "amsterdamify"
@@ -1737,7 +1728,7 @@ case "${text}" in
esac
esac
- if [ "${recipient}" != "${text}" ];
+ if [ "${recipient}" != "${IRC_PRIVMSG_TEXT}" ];
then
user="${recipient}"
fi
@@ -1756,7 +1747,7 @@ case "${text}" in
if [ -s "${outpath}" ];
then
- annna-say -s "${server}" -c "${channel}" "${user}, gophers://bitreich.org/${outtype}/memecache/filter/${outfile}"
+ annna-say "${IRC_CMD_USER}, gophers://bitreich.org/${outtype}/memecache/filter/${outfile}"
exit 0
fi
@@ -1787,84 +1778,84 @@ case "${text}" in
if [ -s "${outpath}" ];
then
- annna-say -s "${server}" -c "${channel}" "${user}, gophers://bitreich.org/${outtype}/memecache/filter/${outfile}"
+ annna-say "${IRC_CMD_USER}, gophers://bitreich.org/${outtype}/memecache/filter/${outfile}"
fi
} &
exit 0
;;
-"${ircuser}, please 3d "*)
- args=$(echo ${text} | cut -d' ' -f 4-)
+"${IRC_USER}, please 3d "*)
+ args=$(echo ${IRC_PRIVMSG_TEXT} | cut -d' ' -f 4-)
outfile=$(blender-effect $args)
- annna-say -s "${server}" -c "${channel}" "${user}, gophers://bitreich.org/I/memecache/3d/${outfile}"
+ annna-say "${IRC_CMD_USER}, gophers://bitreich.org/I/memecache/3d/${outfile}"
;;
-"${ircuser}, droggelbecher"*)
+"${IRC_USER}, droggelbecher"*)
# https://ednaundharvey.fandom.com/de/wiki/Droggelbecher
- annna-say -s "${server}" -c "${channel}" "${user}, Droggelbecher!"
+ annna-say "${IRC_CMD_USER}, Droggelbecher!"
;;
-"${ircuser}, thanks"*|"${ircuser}, thx"*)
- annna-say -s "${server}" -c "${channel}" "${user}, you're welcome."
+"${IRC_USER}, thanks"*|"${IRC_USER}, thx"*)
+ annna-say "${IRC_CMD_USER}, you're welcome."
;;
-"${ircuser}, please simulate "*" simulator"*)
- q="${text#* please simulate }"
+"${IRC_USER}, please simulate "*" simulator"*)
+ q="${IRC_PRIVMSG_TEXT#* please simulate }"
q="${q% simulator*}"
outpath="/br/gopher/p/"
{
if outfile="$(simulate-simulator "$q")"
then
mv "${outfile}" "${outpath}/"
- annna-say -s "${server}" -c "${channel}" "${user}, gophers://bitreich.org/I/p/${outfile}"
+ annna-say "${IRC_CMD_USER}, gophers://bitreich.org/I/p/${outfile}"
fi
} &
;;
-"${ircuser}, can "*" certify itself?")
- q="${text#* can }"
+"${IRC_USER}, can "*" certify itself?")
+ q="${IRC_PRIVMSG_TEXT#* can }"
q="${q% certify*}"
{
# host:port is needed for tlsgrab
curi="$(tlsgrab "${q}")"
if [ -n "${curi}" ];
then
- annna-say -s "${server}" -c "${channel}" "${user}, let us see the certificate: ${curi}"
+ annna-say "${IRC_CMD_USER}, let us see the certificate: ${curi}"
fi
} &
;;
-"${ircuser}, please mine "*" bitreichcoin"*)
- q="${text#* please mine }"
+"${IRC_USER}, please mine "*" bitreichcoin"*)
+ q="${IRC_PRIVMSG_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}"
+ annna-say "${IRC_CMD_USER}, please don't spend it all at once: ${curi}"
;;
-"${ircuser}, please hug me.")
- annna-say -s "${server}" -c "${channel}" "$(echo -e '\001')ACTION hugs ${user}$(echo -e '\001')"
+"${IRC_USER}, please hug me.")
+ annna-say "$(echo -e '\001')ACTION hugs ${IRC_CMD_USER}$(echo -e '\001')"
;;
-"${ircuser}, please hug "*" for me.")
- huggee="${text#* please hug }"
+"${IRC_USER}, please hug "*" for me.")
+ huggee="${IRC_PRIVMSG_TEXT#* please hug }"
huggee="${huggee% for me*}"
if [ -n "${huggee}" ];
then
- annna-say -s "${server}" -c "${channel}" "$(echo -e '\001')ACTION hugs ${huggee}$(echo -e '\001')"
+ annna-say "$(echo -e '\001')ACTION hugs ${huggee}$(echo -e '\001')"
fi
;;
-"${ircuser}, how many fucks were given?")
- annna-say -s "${server}" -c "${channel}" "${user}, current fucks given: 0.0"
+"${IRC_USER}, how many fucks were given?")
+ annna-say "${IRC_CMD_USER}, current fucks given: 0.0"
;;
-"${ircuser}, please slam the door.")
- annna-say -s "${server}" -c "${channel}" "${user}, *BANG*"
+"${IRC_USER}, please slam the door.")
+ annna-say "${IRC_CMD_USER}, *BANG*"
;;
-"${ircuser}, what is my credit score?")
- annna-say -s "${server}" -c "${channel}" "${user}, your credit score is 0."
+"${IRC_USER}, what is my credit score?")
+ annna-say "${IRC_CMD_USER}, your credit score is 0."
;;
-"${ircuser}, please give me a cookie.")
+"${IRC_USER}, please give me a cookie.")
cookie="$(cookie)"
if [ -n "${cookie}" ];
then
- annna-say -s "${server}" -c "${channel}" "$(echo -e '\001')ACTION gives ${user} a ${cookie} cookie$(echo -e '\001')"
+ annna-say "$(echo -e '\001')ACTION gives ${IRC_CMD_USER} a ${cookie} cookie$(echo -e '\001')"
fi
;;
-"${ircuser}, please help.")
- annna-say -s "${server}" -c "${user}" "See git://bitreich.org/annna for my commands."
+"${IRC_USER}, please help.")
+ annna-say -c "${IRC_CMD_USER}" "See git://bitreich.org/annna for my commands."
;;
-"${ircuser}, please meme meme meme me.")
+"${IRC_USER}, please meme meme meme me.")
randomtag=2
while [ $randomtag -gt 0 ];
do
@@ -1877,45 +1868,45 @@ case "${text}" in
taguri="${tag}"
done
- annna-say -s "${server}" -c "${channel}" "${tagname}: ${taguri}"
+ annna-say "${tagname}: ${taguri}"
randomtag=$((randomtag - 1))
done
;;
-"${ircuser}, what's the wheelchair shooter meme again?")
+"${IRC_USER}, 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)"
taguri="$(printf "%s\n" "${tagline}" | cut -d ' ' -f 2-)"
- annna-say -s "${server}" -c "${channel}" "${tagname}: ${taguri}"
+ annna-say "${tagname}: ${taguri}"
;;
-"${ircuser}, TIL "*)
+"${IRC_USER}, TIL "*)
minimum_learned_len=12
- offset=$(( ${#ircuser} + 6 ))
- learned="$(printf "%s\n" "${text}" \
+ offset=$(( ${#IRC_USER} + 6 ))
+ learned="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" \
| cut -c $offset- \
| sed 's,\t, ,g')"
if [ ${#learned} -le $minimum_learned_len ];
then
- annna-say -s "${server}" -c "${channel}" "${user}, can you explain better what you learned?"
+ annna-say "${IRC_CMD_USER}, can you explain better what you learned?"
else
- result="$(til ${user} "${learned}")"
+ result="$(til ${IRC_CMD_USER} "${learned}")"
if [ $? -eq 0 ];
then
- annna-say -s "${server}" -c "${channel}" "${user}, ${result}"
+ annna-say "${IRC_CMD_USER}, ${result}"
fi
fi
;;
-"${ircuser}, what have I learned?")
- if result=$(til-user ${user});
+"${IRC_USER}, what have I learned?")
+ if result=$(til-user ${IRC_CMD_USER});
then
- annna-say -s "${server}" -c "${channel}" "${user}, ${result}"
+ annna-say "${IRC_CMD_USER}, ${result}"
fi
;;
esac
-printf '%s' "$text" | awk -v taglimit="$printnhashtags" '
+printf '%s' "${IRC_PRIVMSG_TEXT}" | awk -v taglimit="$printnhashtags" '
$0 !~ /#nospoil/ {
while (match($0, /[#*&]+[^# /"'\'',?!;$\001]+/)) {
tag = substr($0, RSTART, RLENGTH)
@@ -1975,7 +1966,7 @@ do
if [ -e "${outpath}" ];
then
outfile="$(basename "${outpath}")"
- annna-say -s "${server}" -c "${channel}" "${origtag}: gophers://bitreich.org/9/memecache/filter/${outfile}"
+ annna-say "${origtag}: gophers://bitreich.org/9/memecache/filter/${outfile}"
fi
elif [ $revpointer -eq 1 ];
then
@@ -2004,10 +1995,10 @@ do
if [ -e "${outpath}" ];
then
outfile="$(basename "${outpath}")"
- annna-say -s "${server}" -c "${channel}" "${origtag}: gophers://bitreich.org/9/memecache/filter/${outfile}"
+ annna-say "${origtag}: gophers://bitreich.org/9/memecache/filter/${outfile}"
fi
else
- annna-say -s "${server}" -c "${channel}" "${tagline% *}: ${tagline#* }"
+ annna-say "${tagline% *}: ${tagline#* }"
fi
fi
else
@@ -2019,43 +2010,43 @@ do
didyoumean="$(annna-meme-recommend "${tag}")"
if [ -n "${didyoumean}" ];
then
- annna-say -c "${server}" -c "${channel}" "Did you mean: ${didyoumean}?"
+ annna-say "Did you mean: ${didyoumean}?"
fi
fi
fi
fi
done
-case "${text}" in
+case "${IRC_PRIVMSG_TEXT}" in
*\#nospoil*)
;;
*rfc[0-9]*)
- rfcname="$(printf "%s\n" "${text}" | sed 's,.*\(rfc[0-9]*\).*,\1,')"
- annna-say -s "${server}" -c "${channel}" "${rfcname}: ftp://ftp.rfc-editor.org/in-notes/${rfcname}.txt"
+ rfcname="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | sed 's,.*\(rfc[0-9]*\).*,\1,')"
+ annna-say "${rfcname}: ftp://ftp.rfc-editor.org/in-notes/${rfcname}.txt"
;;
*RFC[0-9]*)
- rfcname="$(printf "%s\n" "${text}" | sed 's,.*\(RFC[0-9]*\).*,\1,' | tr '[A-Z]' '[a-z]')"
- annna-say -s "${server}" -c "${channel}" "${rfcname}: ftp://ftp.rfc-editor.org/in-notes/${rfcname}.txt"
+ rfcname="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | sed 's,.*\(RFC[0-9]*\).*,\1,' | tr '[A-Z]' '[a-z]')"
+ annna-say "${rfcname}: ftp://ftp.rfc-editor.org/in-notes/${rfcname}.txt"
;;
esac
# Always keep the karma / shame last!
-case "${text}" in
+case "${IRC_PRIVMSG_TEXT}" in
*"-shaming"*)
- shametext="$(printf "%s\n" "${text}" | sed 's,.* \(.*-shaming\).*,\1,')"
+ shametext="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | sed 's,.* \(.*-shaming\).*,\1,')"
shame "${shametext}" >/dev/null
;;
*"arma is a bitch"*)
- annna-say -s "${server}" -c "${channel}" "${user}, I object! Karma is a nice girl!"
+ annna-say "${IRC_CMD_USER}, I object! Karma is a nice girl!"
;;
"score "*)
# For referee scoring.
;;
*++|*--|*-=?|*+=?|*+=-?|*-=-?)
- karmatext="$(karma "${text}")"
+ karmatext="$(karma "${IRC_PRIVMSG_TEXT}")"
if [ -n "$karmatext" ];
then
- annna-say -s "${server}" -c "${channel}" "karma: ${karmatext}"
+ annna-say "karma: ${karmatext}"
fi
;;
esac
@@ -2068,27 +2059,27 @@ do
done
[ $ismember -lt 1 ] && exit
-case "${text}" in
-"${ircuser}, please go to sleep.")
- annna-say -s "${server}" -c "${channel}" "Going to sleep ... Zzzz ..."
- touch "${ircbase}/annna-is-sleeping"
+case "${IRC_PRIVMSG_TEXT}" in
+"${IRC_USER}, please go to sleep.")
+ annna-say "Going to sleep ... Zzzz ..."
+ touch "${ANNNA_BASE}/sleeping"
;;
-"${ircuser}, please wake up.")
- rm -f "${ircbase}/annna-is-sleeping"
- annna-say -s "${server}" -c "${channel}" "Good morning BITREICH!"
+"${IRC_USER}, please wake up.")
+ rm -f "${ANNNA_BASE}/sleeping"
+ annna-say "Good morning BITREICH!"
;;
-"${ircuser}, can you show me the uptime please?")
- annna-say -s "${server}" -c "${channel}" "$(hostname) uptime: $(uptime)"
+"${IRC_USER}, can you show me the uptime please?")
+ annna-say "$(hostname) uptime: $(uptime)"
;;
-"${ircuser}, please show me the load.")
- annna-say -s "${server}" -c "${channel}" "$(hostname) load: $(LANG=C uptime | sed 's,.*load average: \(.*\)$,\1,')"
+"${IRC_USER}, please show me the load.")
+ annna-say "$(hostname) load: $(LANG=C uptime | sed 's,.*load average: \(.*\)$,\1,')"
;;
-"${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)"
+"${IRC_USER}, please give me the count of online users.")
+ annna-say "$(hostname): $(who -q | tail -n 1 | cut -d'=' -f 2)"
;;
-"${ircuser}, please update the phlog index.")
+"${IRC_USER}, 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! :)"
+ annna-say "Thanks! Your request has been fulfilled with the quickness! :)"
;;
esac
@@ -2100,15 +2091,15 @@ do
done
[ $isreferee -lt 1 ] && exit
-case "${text}" in
+case "${IRC_PRIVMSG_TEXT}" in
"score "*)
- text="$(printf "%s\n" "${text}" | cut -d' ' -f2-)"
- case "${text}" in
+ text="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -d' ' -f2-)"
+ case "${IRC_PRIVMSG_TEXT}" in
*++|*--|*-=?|*+=?|*+=-?|*-=-?|*-=??|*+=??|*-=-??|*-=65536*)
- scoretext="$(brcon-score "${text}")"
+ scoretext="$(brcon-score "${IRC_PRIVMSG_TEXT}")"
if [ -n "$scoretext" ];
then
- annna-say -s "${server}" -c "${channel}" "brcon score: ${scoretext}"
+ annna-say "brcon score: ${scoretext}"
fi
;;
esac
DIR diff --git a/annna-message-gopherproject b/annna-message-gopherproject
@@ -1,19 +0,0 @@
-#!/bin/sh -e
-
-cfgbase="$(pwd)"
-ircbase="$(cat ${cfgbase}/ircbase)"
-modbase="$(cat ${cfgbase}/modbase)"
-
-server="$1"
-ircuser="$(cat ${cfgbase}/${server}/ircuser)"
-channel="$2"
-user="$3"
-text="$4"
-cmd="$5"
-
-[ "$user" = "${ircuser}" ] && exit
-
-# Nothing so far for gopherproject.
-
-annna-message-common "${server}" "${channel}" "${user}" "${text}" "${cmd}"
-
DIR diff --git a/annna-message-radio b/annna-message-radio
@@ -1,59 +1,46 @@
#!/bin/sh -e
-export PATH="/br/bin:$PATH"
+[ "$IRC_CMD_USER" = "${IRC_USER}" ] && exit
-cfgbase="$(pwd)"
-ircbase="$(cat ${cfgbase}/ircbase)"
-modbase="$(cat ${cfgbase}/modbase)"
-
-server="$1"
-ircuser="$(cat ${cfgbase}/${server}/ircuser)"
-channel="$2"
-user="$3"
-text="$4"
-cmd="$5"
-
-[ "$user" = "${ircuser}" ] && exit
-
-case "${text}" in
-"${ircuser}, next song please.") /usr/bin/mpc -q next; exit;;
-"${ircuser}, prev song please.") /usr/bin/mpc -q prev; exit;;
-"${ircuser}, please shuffle.") /usr/bin/mpc -q shuffle; exit;;
-"${ircuser}, please toggle random.") /usr/bin/mpc -q random; exit;;
-"${ircuser}, please toggle single.") /usr/bin/mpc -q single; exit;;
-"${ircuser}, please toggle consume.") /usr/bin/mpc -q consume; exit;;
-"${ircuser}, please rescan.") /usr/bin/mpc -q rescan; exit;;
-"${ircuser}, how many people listen to the radio?")
- annna-say -s "${server}" -c "${channel}" "${user}, $(/br/bin/bitreich-radio-listener-count)"
+case "${IRC_PRIVMSG_TEXT}" in
+"${IRC_USER}, next song please.") /usr/bin/mpc -q next; exit;;
+"${IRC_USER}, prev song please.") /usr/bin/mpc -q prev; exit;;
+"${IRC_USER}, please shuffle.") /usr/bin/mpc -q shuffle; exit;;
+"${IRC_USER}, please toggle random.") /usr/bin/mpc -q random; exit;;
+"${IRC_USER}, please toggle single.") /usr/bin/mpc -q single; exit;;
+"${IRC_USER}, please toggle consume.") /usr/bin/mpc -q consume; exit;;
+"${IRC_USER}, please rescan.") /usr/bin/mpc -q rescan; exit;;
+"${IRC_USER}, how many people listen to the radio?")
+ annna-say -s "${IRC_SERVER}" -c "${IRC_CHANNEL}" "${IRC_CMD_USER}, $(/br/bin/bitreich-radio-listener-count)"
exit;;
-"${ircuser}, please radio play "*)
- url="$(printf "%s\n" "${text}" | cut -c 25- | sed 's,\t, ,g')"
+"${IRC_USER}, please radio play "*)
+ url="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -c 25- | sed 's,\t, ,g')"
{
ytdl-mpd -a -m -q "$url"
- annna-say -s "${server}" -c "${channel}" "Your download ${url} is done."
+ annna-say "Your download ${url} is done."
} &
exit;;
-"${ircuser}, please radio say "*)
- word="$(printf "%s\n" "${text}" | cut -c 25- | sed 's,\t, ,g')"
+"${IRC_USER}, please radio say "*)
+ word="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -c 25- | sed 's,\t, ,g')"
{
printf "%s\n" "${word}" | bitreich-radio-speak
- annna-say -s "${server}" -c "${channel}" "The speech is done."
+ annna-say "The speech is done."
} &
exit;;
-"${ircuser}, please stop speaking on radio.")
+"${IRC_USER}, please stop speaking on radio.")
if pkill -f bitreich-radio-speak >/dev/null 2>&1;
then
- annna-say -s "${server}" -c "${channel}" "${user}, I stopped speaking."
+ annna-say "${IRC_CMD_USER}, I stopped speaking."
else
- annna-say -s "${server}" -c "${channel}" "${user}, sorry, no instances found."
+ annna-say "${IRC_CMD_USER}, sorry, no instances found."
fi
exit;;
-"${ircuser}, please radio status.")
+"${IRC_USER}, please radio status.")
mpc_status="$(/usr/bin/mpc status | grep '\[.*\]' -o | tr -d '[]')"
[ -z "$mpc_status" ] && mpc_status="gone"
- annna-say -s "${server}" -c "${channel}" "The radio is ${mpc_status}."
+ annna-say "The radio is ${mpc_status}."
exit;;
esac
-annna-message-common "${server}" "${channel}" "${user}" "${text}" "${cmd}"
+annna-message-common "${IRC_SERVER}" "${IRC_CHANNEL}" "${IRC_CMD_USER}" "${IRC_PRIVMSG_TEXT}" "${IRC_CMD}"
DIR diff --git a/annna-message-sauna b/annna-message-sauna
@@ -1,24 +1,11 @@
#!/bin/sh -e
-export PATH="/br/bin:$PATH"
+[ "$IRC_CMD_USER" = "${IRC_USER}" ] && exit
-cfgbase="$(pwd)"
-ircbase="$(cat ${cfgbase}/ircbase)"
-modbase="$(cat ${cfgbase}/modbase)"
-
-server="$1"
-ircuser="$(cat ${cfgbase}/${server}/ircuser)"
-channel="$2"
-user="$3"
-text="$4"
-cmd="$5"
-
-[ "$user" = "${ircuser}" ] && exit
-
-case "${cmd}" in
-JOIN) annna-say -s "${server}" -c "${channel}" "Welcome ${user}! Please grab a towel and have fun!";;
-PART) annna-say -s "${server}" -c "${channel}" $'\001ACTION puts the towel in the laundry.\001';;
+case "${IRC_CMD}" in
+JOIN) annna-say "Welcome ${IRC_CMD_USER}! Please grab a towel and have fun!";;
+PART) annna-say $'\001ACTION puts the towel in the laundry.\001';;
esac
-annna-message-common "${server}" "${channel}" "${user}" "${text}" "${cmd}"
+annna-message-common
DIR diff --git a/annna-message-wikigame b/annna-message-wikigame
@@ -1,37 +1,22 @@
#!/bin/sh -e
-cfgbase="$(pwd)"
-ircbase="$(cat ${cfgbase}/ircbase)"
-modbase="$(cat ${cfgbase}/modbase)"
+[ "$IRC_CMD_USER" = "${IRC_USER}" ] && exit
-server="$1"
-ircuser="$(cat ${cfgbase}/${server}/ircuser)"
-channel="$2"
-user="$3"
-text="$4"
-cmd="$5"
-
-[ "$user" = "${ircuser}" ] && exit
-
-saytext=""
-case "${text}" in
+say_text=""
+case "${IRC_PRIVMSG_TEXT}" in
init|summary|hint|more|giveup)
- saytext="$(wikipediagame "${text}")"
+ say_text="$(wikipediagame "${IRC_PRIVMSG_TEXT}")"
;;
"init "*)
- inittext="$(printf "%s\n" "${text}" | cut -c 5-)"
- saytext="$(wikipediagame init "${inittext}")"
+ init_text="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -c 5-)"
+ say_text="$(wikipediagame init "${init_text}")"
;;
"guess "*)
- guesstext="$(printf "%s\n" "${text}" | cut -c 6-)"
- saytext="$(wikipediagame guess "${guesstext}")"
+ guess_text="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -c 6-)"
+ say_text="$(wikipediagame guess "${guess_text}")"
;;
esac
+[ -n "${say_text}" ] && annna-say "${say_text}"
-if [ -n "${saytext}" ];
-then
- annna-say -s "${server}" -c "${channel}" "${saytext}"
-fi
-
-annna-message-common "${server}" "${channel}" "${user}" "${text}" "${cmd}"
+annna-message-common
DIR diff --git a/annna-say b/annna-say
@@ -1,52 +1,43 @@
#!/bin/sh
#
-# annna-say -s irc.bitreich.org -c '#bitreich-en' Hello World!
+# annna-say -a $HOME/annna -s irc.bitreich.org -c '#bitreich-en' Hello World!
+# export ANNNA_BASE=$HOME/annna
# annna-say -c 'irc.bitreich.org/#bitreich-en' Hello World!
#
-if [ "$(basename "$0")" = "annna-cmd" ];
-then
- outfile="out"
-else
- outfile="in"
-fi
-
-export PATH="$PATH:/home/annna/bin"
+set -x
usage() {
- printf "usage: %s [-h] [-i ircbase] [-s server] -c \"[server/]channel0 ... [server/]channel1 ...\" text\n" \
+ printf "usage: %s [-h] [-a ANNNA_BASE] [-s IRC_SERVER] -c \"[IRC_SERVER/]channel0 ... [IRC_SERVER/]channel1 ...\" text\n" \
"$(basename "$1")" >&2
exit 1
}
-channels=""
-server="irc.bitreich.org"
-ircbase="/home/annna/irc"
+outfile="in"
+[ "$(basename "$0")" = "annna-cmd" ] && outfile="out"
-while getopts "hb:c:s:" opt;
+channels="${IRC_CHANNEL}"
+[ -z "${IRC_SERVER}" ] && export IRC_SERVER="irc.bitreich.org"
+while getopts "ha:c:s:" opt;
do
case $opt in
- b)
- ircbase="$OPTARG"
- ;;
- c)
- channels="$OPTARG"
- ;;
- s)
- server="$OPTARG"
- ;;
- *)
- usage $0
- ;;
+ a) export ANNNA_IRCBASE="$OPTARG";;
+ c) channels="$OPTARG" ;;
+ s) export IRC_SERVER="$OPTARG";;
+ *) usage $0;;
esac
done
shift $(expr $OPTIND - 1)
-
[ -z "$channels" ] && usage $0
-# If annna is not alive, do not bother.
+[ -z "${ANNNA_BASE}" ] && export ANNNA_BASE="/home/annna/annna"
+[ -z "${ANNNA_IRCBASE}" ] && export ANNNA_IRCBASE="$(cat "$ANNNA_BASE/ircbase")"
+[ -z "${ANNNA_MODBASE}" ] && export ANNNA_MODBASE="$(cat "$ANNNA_BASE/modbase")"
+[ -z "${ANNNA_BINBASE}" ] && export ANNNA_BINBASE="$(cat "$ANNNA_BASE/binbase")"
+export PATH="$PATH:${ANNNA_BINBASE}"
+
annna-alive || exit 0
-[ -e "${ircbase}/annna-is-sleeping" ] && exit 0
+annna-sleeps && exit 0
for c in $channels;
do
@@ -56,12 +47,12 @@ do
cname="$(printf "%s\n" "${c}" | cut -d'/' -f 2)"
;;
*)
- cserver="${server}"
+ cserver="${IRC_SERVER}"
cname="${c}"
;;
esac
- ircpath="${ircbase}/${cserver}/${cname}"
+ ircpath="${ANNNA_IRCBASE}/${cserver}/${cname}"
if [ -e "$ircpath/in" ];
then
case "${outfile}" in
@@ -74,7 +65,7 @@ do
;;
esac
else
- ircpath="${ircbase}/${cserver}"
+ ircpath="${ANNNA_IRCBASE}/${cserver}"
# Might be a user. Do not bother with outfile, he/she is not in our control.
printf "%s\n" "$@" \
| fold -w 250 -s \
DIR diff --git a/annna-sleeps b/annna-sleeps
@@ -0,0 +1,13 @@
+#!/bin/sh
+#
+# Check if annna sleeps.
+# Use it this way:
+#
+# if annna-sleeps; then do-something; fi
+#
+
+set -x
+
+[ -f "${ANNNA_BASE}/sleeping" ] && exit 0
+exit 1
+
DIR diff --git a/annna-start b/annna-start
@@ -1,24 +1,48 @@
#!/bin/sh
-export PATH="$PATH:/home/annna/bin"
+set -x
-#cfgbase="$(pwd)"
-cfgbase="$HOME/annna"
-touch ${cfgbase}/running
+if [ $# -lt 1 ];
+then
+ printf "usage: %s cfgdir\n" "$(basename "$0")" >&2
+ exit 1
+fi
-cd ${cfgbase}
-for server in $(find . -maxdepth 1 -type d | tail -n +2 | cut -c 3-);
-do
- [ ! -f ${server}/autoconnect ] && continue
+export ANNNA_BASE="$1"
+[ ! -d "${ANNNA_BASE}" ] && printf "%s not a directory.\n" "${ANNNA_BASE}" >&2 && exit 1
+
+[ ! -e "${ANNNA_BASE}/binbase" ] && printf "No /binbase exists.\n" >&2 && exit 1
+export ANNNA_BINBASE="$(cat "${ANNNA_BASE}/binbase")"
+[ ! -d "${ANNNA_BINBASE}" ] && printf "%s not a directory.\n" "${ANNNA_BINBASE}" >&2 && exit 1
- channels="$(cat ${server}/channels | tr '\n' ' ')"
+[ ! -e "${ANNNA_BASE}/modbase" ] && printf "No /modbase exists.\n" >&2 && exit 1
+export ANNNA_MODBASE="$(cat "${ANNNA_BASE}/modbase")"
+[ ! -d "${ANNNA_MODBASE}" ] && printf "%s not a directory.\n" "${ANNNA_MODBASE}" >&2 && exit 1
- usetls=0
- [ -f ${server}/usetls ] && usetls=1
+[ ! -e "${ANNNA_BASE}/ircbase" ] && printf "No /ircbase exists.\n" >&2 && exit 1
+export ANNNA_IRCBASE="$(cat "${ANNNA_BASE}/ircbase")"
+[ ! -d "${ANNNA_IRCBASE}" ] && printf "%s not a directory.\n" "${ANNNA_IRCBASE}" >&2 && exit 1
- port=6697
- [ -f ${server}/port ] && port="$(cat ${server}/port)"
+export PATH="$PATH:${ANNNA_BINBASE}"
- annna-start-main "${server}" "${usetls}" "${port}" "${channels}"
+cd "${ANNNA_BASE}"
+touch running
+for server in $(find . -maxdepth 1 -type d | tail -n +2 | cut -c 3-);
+do
+ export IRC_SERVER="${server}"
+ [ ! -f ${server}/autoconnect ] && continue
+ export IRC_CHANNELS="$(cat ${server}/channels | tr '\n' ' ')"
+ export IRC_TLS=0
+ [ -f ${server}/tls ] && export IRC_TLS=1
+ export IRC_PORT=6667
+ [ -f ${server}/port ] && export IRC_PORT="$(cat ${server}/port)"
+ export IRC_USER="annna"
+ [ -f ${server}/user ] && export IRC_USER="$(cat ${server}/user)"
+ export IRC_PASS=
+ [ -f ${server}/pass ] && export IRC_PASS="$(cat ${server}/pass)"
+ export IRC_NAME="Gode"
+ [ -f ${server}/name ] && export IRC_NAME="$(cat ${server}/name)"
+
+ annna-start-server
done
DIR diff --git a/annna-start-main b/annna-start-main
@@ -1,113 +0,0 @@
-#!/bin/sh
-
-export PATH="$PATH:/home/annna/bin"
-
-cfgbase="$(pwd)"
-ircbase="$(cat ${cfgbase}/ircbase)"
-
-server="$1"
-usetls="$2"
-[ $usetls -gt 0 ] && tlsparam=" -v -t"
-port="$3"
-channels="$4"
-
-maxtries=10
-maxnicktries=5
-{
- nicktries=0
- iipid=0
- while [ -f ${cfgbase}/running ];
- do
- # Connect
- #socat openssl:${server}:6697,keepalive,keepcnt=5,keepidle=1,keepintvl=1 \
- # unix-l:${ircbase}/${server}/sock &
- #while [ ! -e ${ircbase}/${server}/sock ];
- #do
- # [ -z "$(pgrep socat)" ] && exit 1
- # sleep 0.5
- #done
-
- rm -rf ${ircbase}/${server}
- mkdir -p ${ircbase}/${server}
-
- # Connection
- export ircuser="$(cat ${cfgbase}/${server}/ircuser)"
- [ -n "${ircuser}" ] && ircuserparam=" -n ${ircuser}"
-
- export ircpass="$(cat ${cfgbase}/${server}/ircpass 2>/dev/null)"
- ircpassparam=""
- [ -n "${ircpass}" ] && ircpassparam=" -k ircpass"
-
- if [ -f ${cfgbase}/${server}/fullname ];
- then
- fullname="$(cat ${cfgbase}/${server}/fullname)"
- else
- fullname="Gode"
- fi
-
- # For debugging.
- #ii -s "${server}"${ircpassparam}${ircuserparam}${tlsparam} \
- # -f "${fullname}" -p ${port} &
-
- [ $iipid -gt 0 ] && kill -KILL $iipid >/dev/null 2>&1
-
- ii -s "${server}"${ircpassparam}${ircuserparam}${tlsparam} \
- -f "${fullname}" -p ${port} >/dev/null 2>&1 &
- #ii -s "${server}"${ircpassparam}${ircuserparam}${tlsparam} \
- # -f "${fullname}" -p ${port}
- iipid=$!
-
- sleep 5
-
- tries=0
- ## Waiting for the socket to be available.
- while [ ! -e ${ircbase}/${server}/out ];
- do
- kill -0 $iipid >/dev/null 2>&1 || exit 1
- [ ! -f ${cfgbase}/running ] && exit 1
- tries=$(($tries + 1))
- [ $tries -gt $maxtries ] && break
- sleep 4
- done
- [ $tries -gt $maxtries ] && continue
-
- # 433: Nickname is already in use.
- if [ -n "$(grep " 433 " ${ircbase}/${server}/out)" ];
- then
- nicktries=$(($nicktries + 1))
- [ $nicktries -gt $maxnicktries ] && exit 3
- sleep 30
- continue
- fi
-
- tries=0
- # Check for end of motd.
- while [ -z "$(grep " 376 " ${ircbase}/${server}/out)" ];
- do
- [ ! -f ${cfgbase}/running ] && exit 1
- # Sometimes the connection is too fast and the ii USER
- # and NICK is slurped.
- printf "USER %s\r\nUSER %s localhost %s :%s" \
- "${ircuser}" "${ircuser}" "$(hostname)" \
- "${fullname}" \
- > "${ircbase}/${server}/in"
- tries=$(($tries + 1))
- [ $tries -gt $maxtries ] && break
- sleep 2
- done
- [ $tries -gt $maxtries ] && continue
-
- {
- annna-join-channels "${server}" "${channels}"
- } &
-
- # Watch for ii to exit. Then remove the used directory to have all
- # services disappear.
- while kill -0 $iipid >/dev/null 2>&1;
- do
- sleep 30
- done
- rm -rf ${ircbase}/${server}
- done
-} &
-
DIR diff --git a/annna-start-server b/annna-start-server
@@ -0,0 +1,83 @@
+#!/bin/sh
+
+set -x
+
+maxtries=10
+maxnicktries=5
+#{
+ nicktries=0
+ iipid=0
+ while annna-alive;
+ do
+ export IRC_SERVERBASE="${ANNNA_IRCBASE}/${IRC_SERVER}"
+ rm -rf "${IRC_SERVERBASE}"
+ mkdir -p "${IRC_SERVERBASE}"
+
+ [ $IRC_TLS -gt 0 ] && tlsparam=" -v -t"
+ [ -n "${IRC_USER}" ] && ircuserparam=" -n ${IRC_USER}"
+ ircpassparam=""
+ [ -n "${IRC_PASS}" ] && ircpassparam=" -k IRC_PASS"
+ # For debugging.
+ #ii -s "${IRC_SERVER}"${ircpassparam}${ircuserparam}${tlsparam} \
+ # -f "${fullname}" -p ${IRC_PORT} &
+
+ [ $iipid -gt 0 ] && kill -KILL $iipid >/dev/null 2>&1
+ ii -s "${IRC_SERVER}"${ircpassparam}${ircuserparam}${tlsparam} \
+ -f "${IRC_NAME}" -p ${IRC_PORT} >/dev/null 2>&1 &
+ #ii -s "${IRC_SERVER}"${ircpassparam}${ircuserparam}${tlsparam} \
+ # -f "${fullname}" -p ${IRC_PORT}
+ iipid=$!
+ sleep 5
+
+ tries=0
+ ## Waiting for the socket to be available.
+ while [ ! -e "${IRC_SERVERBASE}/out" ];
+ do
+ kill -0 $iipid >/dev/null 2>&1 || exit 1
+ annna-alive || exit 1
+ tries=$(($tries + 1))
+ [ $tries -gt $maxtries ] && break
+ sleep 4
+ done
+ [ $tries -gt $maxtries ] && continue
+
+ # 433: Nickname is already in use.
+ if [ -n "$(grep " 433 " "${IRC_SERVERBASE}/out")" ];
+ then
+ nicktries=$(($nicktries + 1))
+ [ $nicktries -gt $maxnicktries ] && exit 3
+ sleep 30
+ continue
+ fi
+
+ tries=0
+ # Check for end of motd.
+ while [ -z "$(grep " 376 " "${IRC_SERVERBASE}/out")" ];
+ do
+ annna-alive || exit 1
+ # Sometimes the connection is too fast and the ii USER
+ # and NICK is slurped.
+ printf "USER %s\r\nUSER %s localhost %s :%s" \
+ "${IRC_USER}" "${IRC_USER}" "$(hostname)" \
+ "${IRC_NAME}" \
+ > "${ANNNA_IRCBASE}/${IRC_SERVER}/in"
+ tries=$(($tries + 1))
+ [ $tries -gt $maxtries ] && break
+ sleep 2
+ done
+ [ $tries -gt $maxtries ] && continue
+
+ #{
+ annna-join-channels
+ #} &
+
+ # Watch for ii to exit. Then remove the used directory to have all
+ # services disappear.
+ while kill -0 $iipid >/dev/null 2>&1;
+ do
+ sleep 30
+ done
+ rm -rf "${IRC_SERVERBASE}"
+ done
+#} &
+
DIR diff --git a/annna-start-service b/annna-start-service
@@ -1,35 +1,22 @@
#!/bin/sh
-if [ $# -lt 2 ];
-then
- printf "usage: %s server channel\n" "$(basename "$0")"
- exit 1
-fi
-server="$1"
-channel="$2"
-
-export PATH="$PATH:/home/annna/bin"
-
-cfgbase="$(pwd)"
-ircbase="$(cat ${cfgbase}/ircbase)"
-serverbase="${ircbase}/${server}"
+set -x
# Permissions
-[ -d ${ircbase} ] && chmod o+rx ${ircbase}
-[ -d ${serverbase} ] && chmod o+rx ${serverbase}
-
+[ -d ${ANNNA_IRCBASE} ] && chmod o+rx ${ANNNA_IRCBASE}
+[ -d ${IRC_SERVERBASE} ] && chmod o+rx ${IRC_SERVERBASE}
## Channel handlers
-[ -d "${serverbase}/${channel}" ] \
- && chmod o+rx "${serverbase}/${channel}"
+[ -d "${IRC_SERVERBASE}/${IRC_CHANNEL}" ] \
+ && chmod o+rx "${IRC_SERVERBASE}/${IRC_CHANNEL}"
# For annna-say.
-[ -p "${serverbase}/${channel}/in" ] \
- && chmod o+w "${serverbase}/${channel}/in"
+[ -p "${IRC_SERVERBASE}/${IRC_CHANNEL}/in" ] \
+ && chmod o+w "${IRC_SERVERBASE}/${IRC_CHANNEL}/in"
# For annna-cmd.
-[ -f "${serverbase}/${channel}/out" ] \
- && chmod o+w "${serverbase}/${channel}/out"
+[ -f "${IRC_SERVERBASE}/${IRC_CHANNEL}/out" ] \
+ && chmod o+w "${IRC_SERVERBASE}/${IRC_CHANNEL}/out"
-if [ -f "${serverbase}/${channel}/out" ];
+if [ -f "${IRC_SERVERBASE}/${IRC_CHANNEL}/out" ];
then
- annna-channel-service "${server}" "${channel}" &
+ annna-channel-service &
fi
DIR diff --git a/stable-diffusion-emoji b/stable-diffusion-emoji
@@ -7,8 +7,6 @@ then
exit 1
fi
-export PATH="$HOME/bin:$PATH"
-
emojidb="/br/gopher/emoji"
emojiuribase="gophers://bitreich.org/I/emoji"