Add whatsapp support to annna. - annna - Annna the nice friendly bot. | |
git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws6… | |
Log | |
Files | |
Refs | |
Tags | |
README | |
--- | |
commit 82ec16594549e91c688363246bf139370c61816e | |
parent 68d3a578d1c5561ff4fe4e9216540fb8cd518cf2 | |
Author: Annna Robert-Houdin <[email protected]> | |
Date: Fri, 9 Jul 2021 13:18:04 +0200 | |
Add whatsapp support to annna. | |
Diffstat: | |
M annna-message-common | 7 +++++++ | |
A whatsapp | 12 ++++++++++++ | |
2 files changed, 19 insertions(+), 0 deletions(-) | |
--- | |
diff --git a/annna-message-common b/annna-message-common | |
@@ -283,6 +283,13 @@ case "${text}" in | |
annna-say -c "${channel}" "${user}, ${randomoneliner}" | |
fi | |
;; | |
+*"what's app?") | |
+ maemoapp="$(whatsapp)" | |
+ if [ -n "${maemoapp}" ]; | |
+ then | |
+ annna-say -c "${channel}" "Have you tried? ${maemoapp}" | |
+ fi | |
+ ;; | |
"${botname}, man "*|"${botname}, man "*) | |
exp="$(printf "%s\n" "${text}" | cut -c 12- | sed 's,\t, ,g')" | |
dresult="$(COLUMNS=80 man "${exp}" 2>/dev/null)" | |
diff --git a/whatsapp b/whatsapp | |
@@ -0,0 +1,12 @@ | |
+#!/bin/sh | |
+ | |
+printf "abcdefghijklmnopqrstuvwxyz" \ | |
+ | sed 's,\(.\),\1\n,g' \ | |
+ | shuf -n 1 \ | |
+ | xargs -n 1 printf "https://maedevu.maemo.org/pkgweb/search?q=%s\n" \ | |
+ | xargs -n 1 curl -s \ | |
+ | xml2tsv 2>/dev/null \ | |
+ | grep href \ | |
+ | sed 's,.*href=\([^\t]*\)\t\(.*\),\2 ( https://maedevu.maemo.org\1 ),… | |
+ | shuf -n 1 | |
+ |