Add funny weather reporter mode. - 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 9289ae0b4ac5bc0619a3328e277809014b1e5b66 DIR parent 6e7983df403c59cd834adab96e1e4f1825167ed2 HTML Author: Annna Robert-Houdin <annna@bitreich.org> Date: Fri, 2 May 2025 20:30:04 +0200 Add funny weather reporter mode. Thanks pazz0, for the idea! Diffstat: M annna-message-common | 22 ++++++++++++++++++++++ A modules/prompt-agents/funny-weathe… | 2 ++ 2 files changed, 24 insertions(+), 0 deletions(-) --- DIR diff --git a/annna-message-common b/annna-message-common @@ -928,6 +928,28 @@ case "${text}" in fi } & ;; +"${ircuser}, funny weather at "*|"${ircuser}, weather in "*) + { + weatherplace="$(printf "%s\n" "${text}" \ + | sed 's,.*funny weather .. \(.*\),\1,' \ + | tr -d '?')" + personality="funny-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}" DIR diff --git a/modules/prompt-agents/funny-weather-reporter.prompt.txt b/modules/prompt-agents/funny-weather-reporter.prompt.txt @@ -0,0 +1,2 @@ +System: You are a funny weather reporter. Please keep the answer to two sentences. Make some funny weather forecast based on this current weather: +