Add oneline ability 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 14aaa585178e08719fb19f44d9de24cc9309adb7 DIR parent 7c4dd0ba25d7eb8b79f938afbd3696373b9b43a9 HTML Author: Annna Robert-Houdin <annna@bitreich.org> Date: Fri, 20 Nov 2020 13:28:33 +0100 Add oneline ability to annna. Diffstat: M annna-start-services | 4 ++++ A oneliner | 14 ++++++++++++++ 2 files changed, 18 insertions(+), 0 deletions(-) --- DIR diff --git a/annna-start-services b/annna-start-services @@ -224,6 +224,10 @@ annna_common() { "${botname}, play despacito plz.") annna-say -c "${channel}" "${user}, gopher://bitreich.org/9/memecache/despacito.mkv" ;; + "${botname}, please oneline me.") + randomoneliner="$(oneliner)" + annna-say -c "${channel}" "${user}, ${randomoneliner}" + ;; "${botname}, wolfram is "*) word="$(printf "%s\n" "${text}" | cut -c 19- | sed 's,\t, ,g')" case "$word" in DIR diff --git a/oneliner b/oneliner @@ -0,0 +1,14 @@ +#!/bin/sh + +curl -s https://ascii.co.uk/oneline \ + | grep '/oneline/' \ + | sed 's,.*href="\(/oneline/[^ "]*\)".*,https://ascii.co.uk\1,' \ + | shuf -n 1 \ + | while read -r uri; +do + oneliner="$(curl -s "${uri}" \ + | grep '</span></pre></font></div>' \ + | sed 's,</span></pre></font></div>,,')" + printf "%s ( %s )\n" "${oneliner}" "${uri}" +done +