Add github-haha feature. - annna - Annna the nice friendly bot. | |
git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws6… | |
Log | |
Files | |
Refs | |
Tags | |
README | |
--- | |
commit 915de54c569e17c03b836558373a6f9a5a97a5bd | |
parent 7961bcb3b79ba86f88ff14449aff7b60f634769a | |
Author: Annna Robert-Houdin <[email protected]> | |
Date: Tue, 31 Aug 2021 12:54:04 +0200 | |
Add github-haha feature. | |
Thanks for the suggestion, Evil_Bob! | |
Diffstat: | |
M annna-message-common | 10 ++++++++++ | |
A github-haha | 28 ++++++++++++++++++++++++++++ | |
2 files changed, 38 insertions(+), 0 deletions(-) | |
--- | |
diff --git a/annna-message-common b/annna-message-common | |
@@ -620,6 +620,16 @@ case "${text}" in | |
puri="$(sacc gopher://parazyd.org/0/tarot.cgi | /br/bin/bitreich-paste… | |
annna-say -c "${channel}" "${user}, your future is here: ${puri}" | |
;; | |
+"${botname}, haha.") | |
+ { | |
+ # Can take long, so run in background. | |
+ wuri="$(github-haha)" | |
+ if [ -n "${wuri}" ]; | |
+ then | |
+ annna-say -c "${channel}" "${user}, haha ${wuri}" | |
+ fi | |
+ } & | |
+ ;; | |
"${botname}, how many memes do you know?") | |
annna-say -c "${channel}" "I know $(hashtagcount) memes: gopher://bitr… | |
;; | |
diff --git a/github-haha b/github-haha | |
@@ -0,0 +1,28 @@ | |
+#!/bin/sh | |
+# | |
+# TODO: Add more funny github projects. | |
+# | |
+ | |
+projectselection="newsboat/newsboat" | |
+if [ $# -lt 1 ]; | |
+then | |
+ if [ "$1" = "-h" ]; | |
+ then | |
+ printf "usage: %s [-h] githubuser/githubproject\n" >&2 | |
+ exit 1 | |
+ fi | |
+ | |
+ githubproject="$(printf "%s\n" "${projectselection}" | shuf -n 1)" | |
+else | |
+ githubproject="$1" | |
+fi | |
+ | |
+wuri="$(hurl -H 'User-Agent:' \ | |
+ "https://api.github.com/repos/${githubproject}/issues?per_page=100&sor… | |
+ | json2tsv \ | |
+ | awk -F '\t' '$1 == "[].title" { print "HAHA: " $3; }' \ | |
+ | /br/bin/bitreich-speak)" | |
+[ $? -gt 0 ] && exit 1 | |
+ | |
+printf "%s ( %s )\n" "${githubproject}" "${wuri}" | |
+ |