Introduction
Introduction Statistics Contact Development Disclaimer Help
Add video search. - annna - Annna the nice friendly bot.
git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws6…
Log
Files
Refs
Tags
README
---
commit a7332eca163bb6338851912e77c7ca07356755a1
parent 387b4a7807cbb388e7eeb528f7e48e1680a87838
Author: Annna Robert-Houdin <[email protected]>
Date: Wed, 17 Apr 2024 16:30:52 +0200
Add video search.
Thanks eidolon for the recommendation!
Diffstat:
M annna-message-common | 15 +++++++++++++++
A idiotbox-roulette | 20 ++++++++++++++++++++
2 files changed, 35 insertions(+), 0 deletions(-)
---
diff --git a/annna-message-common b/annna-message-common
@@ -320,6 +320,21 @@ case "${text}" in
annna-say -s "${server}" -c "${channel}" "${user}, your type i…
}
;;
+"${ircuser}, please give me a video about "*)
+ word="$(printf "%s\n" "${text}" | cut -c 38-)"
+ case "$word" in
+ *\?)
+ word="$(printf "%s\n" "${word}" | cut -c -"$((${#word} - 1))")"
+ ;;
+ esac
+ videoresult="$(idiotbox-roulette "${word}")"
+ if [ -n "${videoresult}" ];
+ then
+ annna-say -s "${server}" -c "${channel}" "${user}, ${videoresu…
+ else
+ annna-say -s "${server}" -c "${channel}" "${user}, sorry, noth…
+ fi
+ ;;
"${ircuser}, what is "*)
word="$(printf "%s\n" "${text}" | cut -c 16-)"
case "$word" in
diff --git a/idiotbox-roulette b/idiotbox-roulette
@@ -0,0 +1,20 @@
+#!/bin/sh
+# idiotbox roulette
+# by: eidolon
+# Thanks!
+
+[ -z "$1" ] && exit 1
+
+printf '/idiotbox.cgi\t%s\r\n' "$1" |
+ nc codemadness.org 70 |
+ awk -v seed="$RANDOM" '
+ BEGIN { FS="\t"; srand(seed) }
+
+ /^h/ && !/^hAtom/ { out[i++] = $1" "$2 }
+
+ END {
+ p = out[int(rand()*length(out))]
+ p = substr(p, 2)
+ print p
+ }
+ ' | sed 's,URL:,url: ,'
You are viewing proxied material from bitreich.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.