Add color weather support. - 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 372e056f8f6d3f389df1c262b4398959525a7f3e
DIR parent c990180f2232737b76dce75d6e2cb9add10e2303
HTML Author: Annna Robert-Houdin <annna@bitreich.org>
Date: Sun, 15 Jun 2025 21:35:21 +0200
Add color weather support.
Thanks pazz0, for the idea!
Diffstat:
M annna-message-common | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+), 0 deletions(-)
---
DIR diff --git a/annna-message-common b/annna-message-common
@@ -958,6 +958,28 @@ case "${text}" in
fi
} &
;;
+"${ircuser}, color weather at "*|"${ircuser}, color weather in "*)
+ {
+ weatherplace="$(printf "%s\n" "${text}" \
+ | sed 's,.*color weather .. \(.*\),\1,' \
+ | tr -d '?')"
+ personality="color-weather-reporter"
+ preprompt="$(cat ${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:")"
+ } &
+ else
+ weathertext="there is no weather at ${weatherplace}"
+ prompt="${weathertext}"
+ {
+ annna-say -s "${server}" -c "${channel}" "${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}"