Add based.cooking recipe support in annna. - annna - Annna the nice friendly bo… | |
git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws6… | |
Log | |
Files | |
Refs | |
Tags | |
README | |
--- | |
commit 358059de37d3a000b08cb98b831aad0f89db6557 | |
parent 93077586fdfb8e2bb1cefc5c5f03b3f56f3d54b2 | |
Author: Annna Robert-Houdin <[email protected]> | |
Date: Sun, 4 Apr 2021 20:37:23 +0200 | |
Add based.cooking recipe support in annna. | |
Diffstat: | |
M annna-message-common | 9 +++++++++ | |
A based.recipe | 13 +++++++++++++ | |
2 files changed, 22 insertions(+), 0 deletions(-) | |
--- | |
diff --git a/annna-message-common b/annna-message-common | |
@@ -491,6 +491,15 @@ case "${text}" in | |
horostr="$($HOME/scm/bullshit/horoscope)" | |
annna-say -c "${channel}" "${user}, ${horostr}" | |
;; | |
+"${botname}, what should I cook"*) | |
+ recipestr="$(based.recipe)" | |
+ if [ -n "${recipestr}" ]; | |
+ then | |
+ annna-say -c "${channel}" "${user}, ${recipestr}" | |
+ else | |
+ annna-say -c "${channel}" "${user}, I have no recommendation f… | |
+ fi | |
+ ;; | |
"${botname}, what's my future?") | |
puri="$(sacc gopher://parazyd.org/0/tarot.cgi | /br/bin/bitreich-paste… | |
annna-say -c "${channel}" "${user}, your future is here: ${puri}" | |
diff --git a/based.recipe b/based.recipe | |
@@ -0,0 +1,13 @@ | |
+#!/bin/sh | |
+ | |
+baseuri="https://based.cooking/" | |
+ | |
+hurl "${baseuri}" \ | |
+ | grep "^<li><a href=\"[a-zA-Z0-9-]*.html\"" \ | |
+ | sed 's,.*a href="\([a-zA-Z0-9-]*.html\)">\(.*\)</a></li>$,\1\t\2,g' \ | |
+ | shuf -n 1 \ | |
+| while read -r htmluri recipename; | |
+do | |
+ printf "%s ( %s%s )\n" "${recipename}" "${baseuri}" "${htmluri}" | |
+done | |
+ |