Add whatsapp support to annna. - 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 82ec16594549e91c688363246bf139370c61816e DIR parent 68d3a578d1c5561ff4fe4e9216540fb8cd518cf2 HTML Author: Annna Robert-Houdin <annna@bitreich.org> 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(-) --- DIR 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)" DIR 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 +