Add Cities: Bitreich support to annna. - annna - Annna the nice friendly bot. (HTM) git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/annna/ (DIR) Log (DIR) Files (DIR) Refs (DIR) Tags (DIR) README --- (DIR) commit e489a6cc3673be7a03014d163b53afb396990d07 (DIR) parent bc428e9d016c26aef357a3cd5ff076d3f8041812 (HTM) Author: Annna Robert-Houdin <annna@bitreich.org> Date: Wed, 13 Apr 2022 18:36:13 +0200 Add Cities: Bitreich support to annna. Diffstat: M annna-message-common | 9 +++++++++ A this-city-does-not-exist | 7 +++++++ 2 files changed, 16 insertions(+), 0 deletions(-) --- (DIR) diff --git a/annna-message-common b/annna-message-common @@ -760,6 +760,15 @@ case "${text}" in "${botname}, please clap for me.") annna-say -s "${server}" -c "${channel}" "${user}, *clap* *clap* *clap*" ;; +"${botname}, which city does not exist?") + cityuri="$(this-city-does-not-exist)" + if [ -n "${cityuri}" ]; + then + annna-say -s "${server}" -c "${channel}" "${user}, this one: ${cityuri}" + else + annna-say -s "${server}" -c "${channel}" "${user}, none." + fi + ;; "For humanity!") annna-say -s "${server}" -c "${channel}" "${user}, for humanity!" ;; (DIR) diff --git a/this-city-does-not-exist b/this-city-does-not-exist @@ -0,0 +1,7 @@ +#!/bin/sh + +curl -s http://thiscitydoesnotexist.com/ \ + | xml2tsv 2>/dev/null \ + | grep center/img \ + | sed 's,.*src=\.\([^\t]*\).*,http://thiscitydoesnotexist.com\1,' +