Add oneline ability to annna. - annna - Annna the nice friendly bot. | |
git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws6… | |
Log | |
Files | |
Refs | |
Tags | |
README | |
--- | |
commit 14aaa585178e08719fb19f44d9de24cc9309adb7 | |
parent 7c4dd0ba25d7eb8b79f938afbd3696373b9b43a9 | |
Author: Annna Robert-Houdin <[email protected]> | |
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(-) | |
--- | |
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/me… | |
;; | |
+ "${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, ,… | |
case "$word" in | |
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 | |
+ |