Add new annna-channel-message abstraction. - 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 fe32740636247c579ee2a208ce9920dde7d73575 DIR parent a62e3f5f6fbdb0c4932094de2cc1d6358708586e HTML Author: Annna Robert-Houdin <annna@bitreich.org> Date: Tue, 26 Dec 2023 23:27:30 +0100 Add new annna-channel-message abstraction. Diffstat: A annna-channel-message | 32 +++++++++++++++++++++++++++++++ M annna-channel-service | 15 +-------------- 2 files changed, 33 insertions(+), 14 deletions(-) --- DIR diff --git a/annna-channel-message b/annna-channel-message @@ -0,0 +1,32 @@ +#!/bin/sh + +server="$1" +channel="$2" +user="$3" +text="$4" + +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}" + ;; +\#gopherproject) + annna-message-gopherproject "${server}" "${channel}" "${user}" "${text}" + ;; +\#bitreich-wikigame) + annna-message-wikigame "${server}" "${channel}" "${user}" "${text}" + ;; +\#bitreich-idle) + # This one runs its own daemon, so we have to give it a raw message. + printf "$(date +s) <%s> %s\n" >> "${serverbase}/${channel}/out" + ;; +*) + annna-message-common "${server}" "${channel}" "${user}" "${text}" + ;; +esac + DIR diff --git a/annna-channel-service b/annna-channel-service @@ -30,20 +30,7 @@ ls "${serverbase}/${channel}/out" \ | { while read -r user text; do - case "${channel}" in - \#bitreich-radio) - annna-message-radio "${server}" "${channel}" "${user}" "${text}" - ;; - \#gopherproject) - annna-message-gopherproject "${server}" "${channel}" "${user}" "${text}" - ;; - \#bitreich-wikigame) - annna-message-wikigame "${server}" "${channel}" "${user}" "${text}" - ;; - *) - annna-message-common "${server}" "${channel}" "${user}" "${text}" - ;; - esac + annna-channel-message "${server}" "${channel}" "${user}" "${text}" done }