Add mqtt support to annna. - 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 de40edf2f15b54c8f9e7860d93a4a8df55953059 DIR parent 5cb9d9da1d1d315bb749828aaa7982880362f851 HTML Author: Annna Robert-Houdin <annna@bitreich.org> Date: Thu, 8 Aug 2024 21:49:26 +0200 Add mqtt support to annna. Diffstat: M annna-message-common | 14 ++++++++++++++ 1 file changed, 14 insertions(+), 0 deletions(-) --- DIR diff --git a/annna-message-common b/annna-message-common @@ -1086,6 +1086,20 @@ case "${text}" in "${ircuser}, what's up in Japan?") annna-say -s "${server}" -c "${channel}" "${user}, see for yourself: https://nhk3.mov3.co/hls/nhk.m3u8" ;; +"${ircuser}, please mqtt"*) + mqtturi="$(printf '%s\n' "${text}" | cut -d' ' -f 3)" + case "${mqtturi}" in + mqtt:*) + #mqtt:// full URI specified + ;; + *) + #mqtt/sensor specified + mqtturi="mqtt://bitreich:bitreich@mx2.adamsgaard.dk:65431${mqtturi#mqtt}" + ;; + esac + msg="$(printf "%s\n" "${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 cocksucker?" ;;