11 connect("localhost", "rhawk", "#rhtest");
12 json_load("var/plain.json", plain);
21 FROM == OWNER && TO == NICK && /^die in a fire/ {
22 say("Ack, argh, barasdjf..")
26 FROM == OWNER && TO == NICK && /^reload/ {
31 FROM == OWNER && TO == NICK && /^rejoin/ {
37 FROM == OWNER && TO == NICK && /^(join|part)/ {
38 match(MSG, /(join|part) +(#+\w+)/, arr)
39 if (arr[1] && arr[2]) {
40 send(toupper(arr[1]) " " arr[2]);
45 FROM == OWNER && TO == NICK && /^\.msg/ {
46 match(MSG, /.*\.msg +(#*\w+) +(.*)/, arr)
47 send("PRIVMSG " arr[1] " :" arr[2])
51 CMD == "KICK" && ARG == NICK {
52 kick_delay = (kick_delay + 2) * 2
53 system("sleep " kick_delay)
55 reply("I feel happy!")
59 FROM ~ /bo+t$|rhnoise/ {
63 CMD == "NICK" && FROM in bots {
71 json_save("var/plain.json", plain);
76 json_save("var/plain.json", plain);
80 function email(to, from, subj, body, sendmail)
82 from = NICK "<andy@pileus.org>"
83 subj = "Update sfvlug.org!"
84 body = "The next SFVLUG meeting is TBA!"
85 sendmail = "/usr/sbin/sendmail '" to "'"
86 print "To: " to | sendmail
87 print "From: " from | sendmail
88 print "Subject: " subj | sendmail
91 say("Topic out of date, emailing " to);
95 BEGIN { pollchan = "#sfvlug" }
96 #(CMD == "TOPIC" && systime()-lastpoll > 60*60*24) ||
97 (CMD == "PING" && systime()-lastpoll > 60*60*24) ||
98 (CMD == "PRIVMSG" && /^\.poll/) {
99 if (!topics[pollchan]) {
100 debug("Unknown topic for " pollchan);
101 send("TOPIC " pollchan)
104 _curl = "curl -s http://sfvlug.org/"
105 _day = "(Sun|Mon|Tue|Wed|Thu|Fri|Sat)"
106 _web_tba = "next meeting is: TBA"
107 _web_ptrn = "next meeting.*" _day "\\w+[, ]+([A-Z]\\w+) +([0-9]+)[, ]+([0-9]+)"
108 _irc_ptrn = _day "\\w*[, ]+([A-Z]\\w+) +([0-9]+)"
109 while (_curl | getline _line) {
110 if (match(_line, _web_tba))
111 email("Brian <brian@zimage.com>");
112 if (match(_line, _web_ptrn, _parts)) {
113 _date = _parts[1] " " _parts[2] " " _parts[3]
114 _topic = topics[pollchan]
115 sub(_irc_ptrn, _date, _topic)
116 if (_topic != topics[pollchan])
117 topic(pollchan, topics[pollchan] = _topic)
119 debug("topic is already correct")
128 function uptime(time, fmt) {
129 fmt = "%d:%02d:%02d:%02d"
130 fmt = "%d days %02d:%02d:%02d"
133 time / (60*60 ) % 24,
138 _cmd = "git describe --always --dirty";
139 _cmd | getline up_version;
141 up_reload = systime();
144 say("version: " up_version)
148 say("uptime: " uptime(_now - START) ", " \
149 "reload: " uptime(_now - up_reload))
153 TO == NICK && /^/ { extra = "" }
154 TO == NICK && /^\.?fortune.*-o/ { extra = "-o" }
155 TO == NICK && /^\.?fortune/ {
156 gsub(/.*\.?fortune *|-[a-z]* *|[^a-zA-Z0-9 ]/, "", MSG)
157 cmd = "fortune " extra " " (MSG ? "-m '" MSG "'" : "-s")
159 while (cmd | getline _fortune && _lines < 5) {
168 FROM ~ OWNER && /^go go gadget woop/ {
170 say(".delay " i " seconds; .woop " i)
174 gsub(/[^Oo]/, "", $1)
181 for (i=1; i<_len; i++)
182 _woop = _woop " " msg
186 TO == NICK && /^[Ww][Oo]+[Pp] *([0-9]*)/ {
198 TO == NICK && DST ~ /^#/ {
206 say("Awk, awk, awk! I'm a bird!")
210 ((TO == NICK && /(help|halp)/) ||
211 /^[^.](help|halp)/) {
212 reply("Nothing can help you now..")
215 /(\<[Hh][Oo]\>.*){3}/ {
216 say("\00309Merry \00304Christmas!")
220 tolower($0) ~ /\<cloud\>/ {
221 _cmd = "shuf clouds.txt"
222 _cmd | getline _cloud
227 /^headshot [Cc]hristmas/ {
228 say(".load Christmas")
230 say(".unload Christmas")
233 FROM == "rhnoise" && $2 == "slaps" && $3 == NICK {
243 FROM == "rhnoise" && load_mod {
244 say(".load " load_mod)
245 say("rhnoise: You slag!")
250 (TO == "rhnoise" && /^load \w+/) ||
251 (DST == "#rhniose" && /^\.load [a-z]\w+/) {
252 gsub(/[^a-zA-Z0-9_]/, " ")
253 load_mod = toupper(substr($2,1,1)) substr($2,2);
256 (DST == "#rhnoise" && /^\.line /) {
259 say("scalawag: You slag!")
262 (DST == "#rhnoise" && /^\.qdb 268$/) {
266 (DST == "#rhnoise" && /\.qdb *268/) {
276 #FROM == "rhnoise" && !length(user_scores) {
277 # if (split(MSG, _parts, /, /)) {
278 # for (_i=1; _i<=length(_parts); _i++) {
279 # split(_parts[_i], _tmp, ": ");
280 # user_scores[_i]["user"] = _tmp[1];
281 # user_scores[_i]["score"] = _tmp[2];
286 #FROM == "rhnoise" && /^User Scores:$/ {
290 #FROM == OWNER && length(user_scores) &&
291 #tolower($0) ~ /\<nuclear launch detected\>/ {
292 # for (_i=1; _i<=length(user_scores); _i++)
293 # say(user_scores[_i]["user"] "--");