X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;f=rhawk;h=494ce05c9c9a25b485aad90d32c6f9bb6869d73a;hb=refs%2Fheads%2Fauth;hp=952212c0c90fa8b07acb2fc3869beb3cca1bda9c;hpb=7b9042eb3c5ca20ed067219da1ee6ba307cb5750;p=~andy%2Frhawk diff --git a/rhawk b/rhawk index 952212c..494ce05 100755 --- a/rhawk +++ b/rhawk @@ -1,6 +1,7 @@ #!awk -f @include "irc.awk" +@include "json.awk" @include "spades.awk" #@include "email.awk" @@ -8,6 +9,7 @@ BEGIN { OWNER = "andy753421" connect("localhost", "rhawk", "#rhtest"); + json_load("var/plain.json", plain); if (FIRST) { join("#rhnoise") join("#rhspades") @@ -66,14 +68,32 @@ CMD == "NICK" && FROM in bots { # Unicode /[Uu]nicode :-?\(/ { plain[FROM] = 1 + json_save("var/plain.json", plain); } /[Uu]nicode :-?\)/ { - plain[FROM] = 0 + delete plain[FROM] + json_save("var/plain.json", plain); } # SFV Lug +function email(to, from, subj, body, sendmail) +{ + from = NICK "" + subj = "Update sfvlug.org!" + body = "The next SFVLUG meeting is TBA!" + sendmail = "/usr/sbin/sendmail '" to "'" + print "To: " to | sendmail + print "From: " from | sendmail + print "Subject: " subj | sendmail + print "" | sendmail + print body | sendmail + say("Topic out of date, emailing " to); + close(sendmail) +} + BEGIN { pollchan = "#sfvlug" } +#(CMD == "TOPIC" && systime()-lastpoll > 60*60*24) || (CMD == "PING" && systime()-lastpoll > 60*60*24) || (CMD == "PRIVMSG" && /^\.poll/) { if (!topics[pollchan]) { @@ -83,10 +103,12 @@ BEGIN { pollchan = "#sfvlug" } } _curl = "curl -s http://sfvlug.org/" _day = "(Sun|Mon|Tue|Wed|Thu|Fri|Sat)" + _web_tba = "next meeting is: TBA" _web_ptrn = "next meeting.*" _day "\\w+[, ]+([A-Z]\\w+) +([0-9]+)[, ]+([0-9]+)" _irc_ptrn = _day "\\w*[, ]+([A-Z]\\w+) +([0-9]+)" while (_curl | getline _line) { - #debug("match(" _line ", " _web_ptrn ", ..)") + if (match(_line, _web_tba)) + email("Brian "); if (match(_line, _web_ptrn, _parts)) { _date = _parts[1] " " _parts[2] " " _parts[3] _topic = topics[pollchan] @@ -99,10 +121,10 @@ BEGIN { pollchan = "#sfvlug" } } } lastpoll = systime() - close(cmd) + close(_curl) } -# Uptime +# Versin/Uptime function uptime(time, fmt) { fmt = "%d:%02d:%02d:%02d" fmt = "%d days %02d:%02d:%02d" @@ -113,8 +135,14 @@ function uptime(time, fmt) { time / (1 ) % 60) } BEGIN { + _cmd = "git describe --always --dirty"; + _cmd | getline up_version; + close(_cmd); up_reload = systime(); } +/^\.version/ { + say("version: " up_version) +} /^\.uptime/ { _now = systime(); say("uptime: " uptime(_now - START) ", " \ @@ -171,6 +199,7 @@ TO == NICK && DST ~ /^#/ { #say("Hello, " FROM) } +#DST != "#sfvlug" && !(FROM in bots) && MSG !~ /^\./ && /awk/ { @@ -230,6 +259,40 @@ FROM == "rhnoise" && load_mod { say("scalawag: You slag!") } +(DST == "#rhnoise" && /^\.qdb 268$/) { + say(".diediedie"); + next +} +(DST == "#rhnoise" && /\.qdb *268/) { + say(".slap " FROM); + next +} + +# Decrementer +#BEGIN { +# user_scores[0] = 1 +#} +# +#FROM == "rhnoise" && !length(user_scores) { +# if (split(MSG, _parts, /, /)) { +# for (_i=1; _i<=length(_parts); _i++) { +# split(_parts[_i], _tmp, ": "); +# user_scores[_i]["user"] = _tmp[1]; +# user_scores[_i]["score"] = _tmp[2]; +# } +# } +#} +# +#FROM == "rhnoise" && /^User Scores:$/ { +# delete user_scores +#} +# +#FROM == OWNER && length(user_scores) && +#tolower($0) ~ /\/ { +# for (_i=1; _i<=length(user_scores); _i++) +# say(user_scores[_i]["user"] "--"); +#} + # Misc { fflush("") }