q - annna - Annna the nice friendly bot. | |
git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws6… | |
Log | |
Files | |
Refs | |
Tags | |
README | |
--- | |
commit 35a0195af623a556f03b366d2801b9db07076d98 | |
parent 9c44cc4a6bc404e04d332fe438519ac23869ef9d | |
Author: Annna Robert-Houdin <[email protected]> | |
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(-) | |
--- | |
diff --git a/annna-message-common b/annna-message-common | |
@@ -395,6 +395,11 @@ case "${text}" in | |
annna-say -s "${server}" -c "${channel}" "${user}, ${breachtex… | |
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)" | |
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 "${input… | |
+fi | |
+ | |
+replacement="$(printf "%s\n" "$replacement" | tr '[:lower:]' '[:upper:]')" | |
+ | |
+sed "s|{PLEASE_REPLACE_THIS}|$replacement|g" $template | |
+ | |
+ |