Initial commits for idlerpg modification and new services API. - 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 315430ad3cb40801566eb1bf9323dd55cec907c8 DIR parent 30cca049385fa396f500ec051f50af0b3522d3c6 HTML Author: Annna Robert-Houdin <annna@bitreich.org> Date: Sun, 27 Aug 2023 09:15:33 +0200 Initial commits for idlerpg modification and new services API. Diffstat: M annna-channel-service | 17 +++++++++++++---- D annna-message-idle | 25 ------------------------- M annna-stop-services | 1 + 3 files changed, 14 insertions(+), 29 deletions(-) --- DIR diff --git a/annna-channel-service b/annna-channel-service @@ -11,9 +11,21 @@ channel="$2" cfgbase="$(pwd)" ircbase="$(cat ${cfgbase}/ircbase)" +ircuser="$(cat ${cfgbase}/${server}/ircuser)" serverbase="${ircbase}/${server}" +modbase="$(cat ${cfgbase}/modbase)" -ls "${serverbase}/${channel}/out" | entr tail -n 1 "${serverbase}/${channel}/out" 2>/dev/null \ +case "${channel}" in +\#bitreich-idle) + idlebase="${modebase}/idlerpg" + $idlebase/idlerpg-channel-server.py \ + "${ircuser}" "${idlebase}" "${ircbase}" "${server}" "${channel}" + exit $? + ;; +esac + +ls "${serverbase}/${channel}/out" \ + | entr tail -n 1 "${serverbase}/${channel}/out" 2>/dev/null \ | sed -nu 's,[0-9]* <\([^ >]*\)> \(.*\),\1 \2,p' \ | { while read -r user text; @@ -25,9 +37,6 @@ do \#gopherproject) annna-message-gopherproject "${server}" "${channel}" "${user}" "${text}" ;; - \#bitreich-idle) - annna-message-idle "${server}" "${channel}" "${user}" "${text}" - ;; \#bitreich-wikigame) annna-message-wikigame "${server}" "${channel}" "${user}" "${text}" ;; DIR diff --git a/annna-message-idle b/annna-message-idle @@ -1,25 +0,0 @@ -#!/bin/sh -e - -export PATH="$HOME/bin:$PATH" - -cfgbase="$(pwd)" -ircbase="$(cat ${cfgbase}/ircbase)" -modbase="$(cat ${cfgbase}/modbase)" -idlebase="${modbase}/idlerpg" - -server="$1" -ircuser="$(cat ${cfgbase}/${server}/ircuser)" -channel="$2" -user="$3" -text="$4" - -[ "$user" = "${ircuser}" ] && exit - -case "${text}" in -*) - annna-say -c "${channel}" -s "${server}" "${user}, you will be penalized!" - ;; -esac - -#annna-message-common "${server}" "${channel}" "${user}" "${text}" - DIR diff --git a/annna-stop-services b/annna-stop-services @@ -2,4 +2,5 @@ pkill -f "entr tail -n 1 /home/annna/irc.*" pkill -f "annna-channel-service" +pkill -f "idlerpg-channel-service.py"