q - 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 35a0195af623a556f03b366d2801b9db07076d98 DIR parent 9c44cc4a6bc404e04d332fe438519ac23869ef9d HTML Author: Annna Robert-Houdin <annna@bitreich.org> Date: Sun, 31 Jul 2022 11:52:48 +0200 q Diffstat: M annna-message-common | 5 +++++ A responsibility | 20 ++++++++++++++++++++ 2 files changed, 25 insertions(+), 0 deletions(-) --- DIR diff --git a/annna-message-common b/annna-message-common @@ -395,6 +395,11 @@ case "${text}" in annna-say -s "${server}" -c "${channel}" "${user}, ${breachtext}" fi ;; +"${botname}, please be responsible about "*) + word="$(printf "%s\n" "${text}" | cut -c 36- | sed 's,\t, ,g')" + suri="$(responsibility "${word}" | bitreich-paste)" + annna-say -s "${server}" -c "${channel}" "${suri}" + ;; "${botname}, please say "*) word="$(printf "%s\n" "${text}" | cut -c 19- | sed 's,\t, ,g')" suri="$(printf "%s\n" "${word}" | bitreich-speak)" DIR diff --git a/responsibility b/responsibility @@ -0,0 +1,20 @@ +#!/bin/sh + +template="$HOME/bin/modules/responsibility/say-no-to.vtv" +replacemarker="{PLEASE_REPLACE_THIS}" +replacelength="$(utf8expr length "${replacemarker}")" +replaceneutral="' ' ' ' ' ' ' ' ' ' '" + +inputreplacement="$@" +if [ -z "$inputreplacement" ]; +then + replacement="$replaceneutral" +else + replacement="$(utf8expr substr "$(printf "%*s" $replacelength "${inputreplacement}")" 1 $replacelength)" +fi + +replacement="$(printf "%s\n" "$replacement" | tr '[:lower:]' '[:upper:]')" + +sed "s|{PLEASE_REPLACE_THIS}|$replacement|g" $template + +