Add cancel mob support to annna. - annna - Annna the nice friendly bot. | |
git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws6… | |
Log | |
Files | |
Refs | |
Tags | |
README | |
--- | |
commit 62df0bfaf712087f696169755164637b38019928 | |
parent 6cc465c8aca87932d1ad12186b5d58e6e56c9bfd | |
Author: Annna Robert-Houdin <[email protected]> | |
Date: Wed, 14 Apr 2021 21:07:50 +0200 | |
Add cancel mob support to annna. | |
Diffstat: | |
M annna-message-common | 9 +++++++++ | |
A cancel-target | 11 +++++++++++ | |
A get-cancel-list | 6 ++++++ | |
3 files changed, 26 insertions(+), 0 deletions(-) | |
--- | |
diff --git a/annna-message-common b/annna-message-common | |
@@ -479,6 +479,15 @@ case "${text}" in | |
"${botname}, what's down?") | |
annna-say -c "${channel}" "${user}, we all love you." | |
;; | |
+*"ACTION cancels "*) | |
+ mobtarget="$(printf "%s\n" "${text}" | sed 's,.*ACTION cancels \(.*\)\… | |
+ cancel-target "${mobtarget}" | |
+ annna-say -c "${channel}" "${user}, I cancelled ${mobtarget} for you." | |
+ ;; | |
+"${botname}, please show me the mob ranking.") | |
+ canceluri="$(get-cancel-list)" | |
+ annna-say -c "${channel}" "${user}, ${canceluri}" | |
+ ;; | |
"${botname}, I feel sick.") | |
newsstr="$(cd /br/gopher/hypochondria && ./hypochondria -s random)" | |
annna-say -c "${channel}" "You could have ${newsstr}! Be careful!" | |
diff --git a/cancel-target b/cancel-target | |
@@ -0,0 +1,11 @@ | |
+#!/bin/sh | |
+ | |
+if [ $# -lt 1 ]; | |
+then | |
+ printf "usage: %s cancelitem\n" "$(basename "$0")" >&2 | |
+ exit 1 | |
+fi | |
+ | |
+cancelitem="$1" | |
+printf "/cancel\t%s\r\n" "${cancelitem}" | nc bitreich.org 70 2>&1 >/dev/null | |
+ | |
diff --git a/get-cancel-list b/get-cancel-list | |
@@ -0,0 +1,6 @@ | |
+#!/bin/sh | |
+ | |
+printf "/cancel/csv.cgi\r\n" "${cancelitem}" \ | |
+ | nc bitreich.org 70 \ | |
+ | /br/bin/bitreich-paste | |
+ |