commit 5d187014efb53ebee22a7e8691424b9b9cf39a61
parent 0ef9380275fe2bb62ee2c5f5ab4873e74ecae105
Author: hhvn <hayden@hhvn.uk>
Date: Wed, 21 Apr 2021 21:55:16 +0100
filters.sh: update
Diffstat:
M | filters.sh | | | 160 | +++++++++++++++++++++++++++++++++++++++++++++---------------------------------- |
1 file changed, 91 insertions(+), 69 deletions(-)
diff --git a/filters.sh b/filters.sh
@@ -45,68 +45,69 @@ binsu(){
done
}
-# url_title(){
-# export in=$(head -n 1)
-# repl_msg $(
-# echo hi
-# url=$(echo "$in" | sed 's/invidio.us/www.youtube.com/g;s/m.imdb.com/www.imdb.com/g' | tr -d '\r' | sed 's~embed/~watch?v=~g')
-# set -- $url
-# headers=$($tor curl -qsLD - "$1" | tr -d '\r' | sed '/^[^[:print:]]*$/q' | tr '[:upper:]' '[:lower:]')
-# echo "$1" | grep 'http[s]*://[w.]*youtu[.]*be' >/dev/null && {
-# content=$($tor curl -L "$1" | tr -d '\r')
-# printf "05You05,16Tube ::: "
-# echo "Title: $(echo "$content" | grep '\[{\"videoPrimaryInfoRenderer\":{\"title\":{\"runs\"\:\[{\"text\":' | sed 's/.*\[{\"videoPrimaryInfoRenderer\":{\"title\":{\"runs\"\:\[{\"text\":// ; s/}\]}.*// ; s/\\//g ; s/^\"// ; s/.$//') \
-# ::: Author: $(echo "$content" | grep -o 'author":[^}]*}' | sed -E 's/.*:"([^"]*).*/\1/g') \
-# ::: Upload Date: $(echo "$content" | grep -o 'uploadDate":[^}]*}' | sed -E 's/.*:"([^"]*).*/\1/g;s/([0-9]*)-([0-9]*)-([0-9]*)/\3-\2-\1/')"
-# return
-# }
-# echo "$1" | grep 'http[s]*://[w.]*imdb.com' >/dev/null && {
-# content=$($tor curl -L "$1" | tr -d '\r')
-# printf "88,53 IMDb \nTitle: "
-# echo "$content" | grep -o '<title[^>]*>[^<]*</title>' | sed 's~.*<title[^>]*>~~g;s~</title>.*~~g' | head -n 1 | sed 's/ - IMDb//g'
-# printf "Synopsis: "
-# echo "$content" | grep -io '<meta[^>]*"description[^>]*>' | sed -E 's/.*content="([^"]*)".*/\1/' | cut -zc-300
-# printf "Run-time: "
-# echo "$content" | tr '\n' '\t' | grep -o "<time datetime=\"[^>]*>[^<]*" | awk -F">" '{print $2}' | sed 's/[[:space:]]*//;s/[[:space:]]*$//' | head -n 1 | tr -d '\n'
-# printf " ::: Genres: "
-# echo "$content" | tr '\n' '\t' | grep -o "\"genre\".*\]," | sed 's/\],.*//g' | tr -d '"\n' | sed 's/genre:[^[:alnum:]]*//' | tr '\t' ' ' | tr -s ' '
-# printf " ::: Stars: "
-# echo "$content" | grep "\"ratingValue\"" | head -n 1 | sed -E 's/.*"([^"]*)"$/\1/g' | tr -d '\n'
-# printf "/10\n"
-# return
-# }
-
-# code=$(echo "$headers" | head -n 1)
-# ctype=$(echo "$headers" | awk -F":" '$1 == "content-type" {print $2}')
-# server=$(echo "$headers" | awk -F":" '$1 == "server" {print $2}')
-
-# echo "$ctype" | grep -v 'text/html' >/dev/null && {
-# echo "$server" | grep -i 'Cloudflare' >/dev/null && send "NOTICE $CHANNEL :Shit: cloudflare." && return
-# echo "$ctype" | grep '[[:alnum:]]' >/dev/null && out="${out}Content-type:$ctype "
-# echo "$server" | grep '[[:alnum:]]' >/dev/null && out="${out}Server:$server "
-# echo "$out" | grep '[[:alnum:]]' >/dev/null && send "$(echo "NOTICE $CHANNEL :$out" | cut -zc-200)"
-# return
-# }
-# content=$($tor curl -L "$1" | tr -d '\r')
-# title=$(echo "$content" | grep -o '<title[^>]*>[^<]*</title>' | sed 's~.*<title[^>]*>~~g;s~</title>.*~~g' | head -n 1)
-# published=$(echo "$content" | grep -o '<meta[^>]*"published_time[^>]*>' | sed -E 's/.*content="([^"]*)".*/\1/;s/T.*//;s~([0-9]*)-([0-9]*)-([0-9]*)~\3/\2/\1~')
-# modified=$(echo "$content" | grep -o '<meta[^>]*"modified_time[^>]*>' | sed -E 's/.*content="([^"]*)".*/\1/;s/T.*//;s~([0-9]*)-([0-9]*)-([0-9]*)~\3/\2/\1~')
-# author=$(echo "$content" | grep -o '<meta[^>]*"author[^>]*>' | sed -E 's/.*content="([^"]*)".*/\1/')
-# generator=$(echo "$content" | grep -io '<meta[^>]*"generator[^>]*>' | sed -E 's/.*content="([^"]*)".*/\1/')
-# description=$(echo "$content" | grep -io '<meta[^>]*"description[^>]*>' | sed -E 's/.*content="([^"]*)".*/\1/' | cut -zc-200)
-
-# echo "$server" | grep -i 'Cloudflare' >/dev/null && send "NOTICE $CHANNEL :Shit: cloudflare." && return
-# echo "$title" | grep '[[:alnum:]]' >/dev/null && out="Title: $title "
-# echo "$published" | grep '[[:alnum:]]' >/dev/null && out="${out}Published: $published "
-# echo "$modified" | grep '[[:alnum:]]' >/dev/null && out="${out}Last modified: $modified "
-# echo "$author" | grep '[[:alnum:]]' >/dev/null && out="${out}Author: $author "
-# echo "$generator" | grep '[[:alnum:]]' >/dev/null && out="${out}Page generator: $generator "
-# echo "$description" | grep '[[:alnum:]]' >/dev/null && out="${out}Description: $description... "
-# echo "$ctype" | grep '[[:alnum:]]' >/dev/null && out="${out}Content-type:$ctype "
-# echo "$server" | grep '[[:alnum:]]' >/dev/null && out="${out}Server:$server "
-# echo "$out" | grep '[[:alnum:]]' >/dev/null && send "$(echo "NOTICE $CHANNEL :$out" | cut -zc-200)"
-# )
-# }
+ url_title(){
+ export in=$(head -n 1)
+ url=$(echo "$in" | sed 's/invidio.us/www.youtube.com/g;s/m.imdb.com/www.imdb.com/g' | tr -d '\r' | sed 's~embed/~watch?v=~g' | grep -o '[a-z]*://[^ ]*' | sed 's/[\.?>,]$//')
+ set -- $url
+ headers=$($tor curl -qsLD - "$1" | tr -d '\r' | sed '/^[^[:print:]]*$/q' | tr '[:upper:]' '[:lower:]')
+ echo "$1" | grep 'http[s]*://[w.]*youtu[.]*be' >/dev/null && {
+ content=$($tor curl -L "$1" | tr -d '\r')
+ repl_notice $(
+ printf "05You05,16Tube ::: "
+ echo "Title: $(echo "$content" | grep '\[{\"videoPrimaryInfoRenderer\":{\"title\":{\"runs\"\:\[{\"text\":' | sed 's/.*\[{\"videoPrimaryInfoRenderer\":{\"title\":{\"runs\"\:\[{\"text\":// ; s/}\]}.*// ; s/\\//g ; s/^\"// ; s/.$//') \
+::: Author: $(echo "$content" | grep -o 'author":[^}]*}' | sed -E 's/.*:"([^"]*).*/\1/g') \
+::: Upload Date: $(echo "$content" | grep -o 'uploadDate":[^}]*}' | sed -E 's/.*:"([^"]*).*/\1/g;s/([0-9]*)-([0-9]*)-([0-9]*)/\3-\2-\1/')"
+ )
+ return
+ }
+ echo "$1" | grep 'http[s]*://[w.]*imdb.com' >/dev/null && {
+ content=$($tor curl -L "$1" | tr -d '\r')
+ repl_notice $(
+ printf "88,53 IMDb \nTitle: "
+ echo "$content" | grep -o '<title[^>]*>[^<]*</title>' | sed 's~.*<title[^>]*>~~g;s~</title>.*~~g' | head -n 1 | sed 's/ - IMDb//g'
+ printf "Synopsis: "
+ echo "$content" | grep -io '<meta[^>]*"description[^>]*>' | sed -E 's/.*content="([^"]*)".*/\1/' | cut -zc-300
+ printf "Run-time: "
+ echo "$content" | tr '\n' '\t' | grep -o "<time datetime=\"[^>]*>[^<]*" | awk -F">" '{print $2}' | sed 's/[[:space:]]*//;s/[[:space:]]*$//' | head -n 1 | tr -d '\n'
+ printf " ::: Genres: "
+ echo "$content" | tr '\n' '\t' | grep -o "\"genre\".*\]," | sed 's/\],.*//g' | tr -d '"\n' | sed 's/genre:[^[:alnum:]]*//' | tr '\t' ' ' | tr -s ' '
+ printf " ::: Stars: "
+ echo "$content" | grep "\"ratingValue\"" | head -n 1 | sed -E 's/.*"([^"]*)"$/\1/g' | tr -d '\n'
+ printf "/10\n"
+ )
+ return
+ }
+
+ code=$(echo "$headers" | head -n 1)
+ ctype=$(echo "$headers" | awk -F":" '$1 == "content-type" {print $2}')
+ server=$(echo "$headers" | awk -F":" '$1 == "server" {print $2}')
+
+ echo "$ctype" | grep -v 'text/html' >/dev/null && {
+ echo "$server" | grep -i 'Cloudflare' >/dev/null && repl_notice "Shit: cloudflare." && return
+ echo "$ctype" | grep '[[:alnum:]]' >/dev/null && out="${out}Content-type:$ctype "
+ echo "$server" | grep '[[:alnum:]]' >/dev/null && out="${out}Server:$server "
+ echo "$out" | grep '[[:alnum:]]' >/dev/null && repl_notice "$(echo "$out" | cut -zc-200)"
+ return
+ }
+ content=$($tor curl -L "$1" | tr -d '\r')
+ title=$(echo "$content" | grep -o '<title[^>]*>[^<]*</title>' | sed 's~.*<title[^>]*>~~g;s~</title>.*~~g' | head -n 1)
+ published=$(echo "$content" | grep -o '<meta[^>]*"published_time[^>]*>' | sed -E 's/.*content="([^"]*)".*/\1/;s/T.*//;s~([0-9]*)-([0-9]*)-([0-9]*)~\3/\2/\1~')
+ modified=$(echo "$content" | grep -o '<meta[^>]*"modified_time[^>]*>' | sed -E 's/.*content="([^"]*)".*/\1/;s/T.*//;s~([0-9]*)-([0-9]*)-([0-9]*)~\3/\2/\1~')
+ author=$(echo "$content" | grep -o '<meta[^>]*"author[^>]*>' | sed -E 's/.*content="([^"]*)".*/\1/')
+ generator=$(echo "$content" | grep -io '<meta[^>]*"generator[^>]*>' | sed -E 's/.*content="([^"]*)".*/\1/')
+ description=$(echo "$content" | grep -io '<meta[^>]*"description[^>]*>' | sed -E 's/.*content="([^"]*)".*/\1/;s/\&\;(#39\;|)/\&/g' | cut -zc-200)
+
+ echo "$server" | grep -i 'Cloudflare' >/dev/null && repl_notice "Shit: cloudflare." && return
+ echo "$title" | grep '[[:alnum:]]' >/dev/null && out="Title: $title "
+ echo "$published" | grep '[[:alnum:]]' >/dev/null && out="${out}Published: $published "
+ echo "$modified" | grep '[[:alnum:]]' >/dev/null && out="${out}Last modified: $modified "
+ echo "$author" | grep '[[:alnum:]]' >/dev/null && out="${out}Author: $author "
+ echo "$generator" | grep '[[:alnum:]]' >/dev/null && out="${out}Page generator: $generator "
+ echo "$description" | grep '[[:alnum:]]' >/dev/null && out="${out}Description: $description... "
+ echo "$ctype" | grep '[[:alnum:]]' >/dev/null && out="${out}Content-type:$ctype "
+ echo "$server" | grep '[[:alnum:]]' >/dev/null && out="${out}Server:$server "
+ echo "$out" | grep '[[:alnum:]]' >/dev/null && repl_notice "$(echo "$out" | cut -zc-200)"
+}
puma(){
repl_msg "Aha, beware the puma, $NAME"
@@ -158,19 +159,40 @@ weather(){
curl "wttr.in?0FqQ/$@" | prepl_msg
}
+sand(){
+ islocked sand && return
+ lock sand 240
+ repl_msg "I don't like sand. It's coarse and rough and irritating and it gets everywhere."
+}
+
+shrug(){
+ repl_action "shrugs"
+ repl_msg "$nick, it is what it is, and that's all it is"
+}
+
+say(){
+ (
+ tr ' ' '\n' | awk 'BEGIN {p=0}; // {if ($1 == "say" || $1 == "Say") p=1; if (p == 1) print}' | tr '\n' ' ' | sed 's/^say //'
+ printf "\r\n"
+ ) | prepl_msg
+}
+
match_motd send_join "#hlircnet"
match_motd send_join "#test"
-match_msg "^($nick: |$nick, |)(good |)(hi|hello|greetings|sup|morning|afternoon|evening|day)(.*$nick.*|)$" greet
-match_msg "(dumb|stupid|retard|useless|pointless).*(bot|$nick)" stupid
+match_msg "^($nick[:,] |)(good |)(hi|hello|greetings|sup|morning|afternoon|evening|day)(.*$nick.*|)$" greet
+match_msg "^(dumb|stupid|retard|useless|pointless).*(bot|$nick)" stupid
match_action "(slaps|smacks|whacks|hits|strikes|punches|shoots|stabs|wounds) $nick" oww
-match_action "(gives|passes|hands).*(blunt|bong|joint)" weed
-match_action "(gives|passes|hands).*job" job
-match_action "(gives|passes|hands).*(food|cookie|biscuit|leftovers|dinner|scraps)" food
+match_action "(gives|passes|hands).*$nick.*(blunt|bong|joint)" weed
+match_action "(gives|passes|hands).*$nick.*job" job
+match_action "(gives|passes|hands).*$nick.*(food|cookie|biscuit|leftovers|dinner|scraps)" food
match_msg "$nick[:,] (wttr|weather)" weather
+match_msg "$nick[:,] say" say
match_msg "$nick[:,] good |)night(.*$nick.*|)$" night
match_msg "$nick[,:] ($(ls bin/ | tr '\n' '|' | sed 's/|$//g'))" bin
match_msg "$nick[,:] (sudo|doas) ($(ls bin/ | tr '\n' '|' | sed 's/|$//g'))" binsu
+match_msg "^poo*p" sand
match_msg "http[s]*://.*" url_title
-match_msg "puma" puma
-match_msg "^(lul|lol|hah|hehe|heh|haha).*wut\?" repl_action "shrugs"
+# match_msg "^(lul|lol|hah|hehe|heh|haha).*wut\?" shrug
match_msg "^marvvin[:,].*" huh
+match_msg "puma" puma
+match_msg "say .*" say