10 json_load("var/login.json", login);
11 json_load("var/nounicode.json", nounicode);
12 json_load("var/nocolor.json", nocolor);
14 OWNER = login["owner"];
16 connect(login["server"], \
32 AUTH == OWNER && TO == NICK && /^die in a fire/ {
33 say("Ack, argh, barasdjf..")
37 AUTH == OWNER && TO == NICK && /^reload/ {
42 AUTH == OWNER && TO == NICK && /^rejoin/ {
48 AUTH == OWNER && TO == NICK && /^(join|part)/ {
49 if (match(MSG, /(join|part) +(#+\w+)/, arr)) {
50 if (arr[1] == "join") join(arr[2]);
51 if (arr[1] == "part") part(arr[2]);
56 AUTH == OWNER && TO == NICK && /^\.msg/ {
57 match(MSG, /.*\.msg +(#*\w+) +(.*)/, arr)
58 send("PRIVMSG " arr[1] " :" arr[2])
62 CMD == "KICK" && ARG[2] == NICK {
63 kick_delay = (kick_delay + 2) * 2
64 system("sleep " kick_delay)
66 reply("I feel happy!")
70 FROM ~ /bo+t$|rhnoise/ {
74 CMD == "NICK" && FROM in bots {
82 json_save("var/nounicode.json", nounicode);
86 delete nounicode[FROM]
87 json_save("var/nounicode.json", nounicode);
92 json_save("var/nocolor.json", nocolor);
97 json_save("var/nocolor.json", nocolor);
101 function email(to, from, subj, body, sendmail)
103 from = NICK "<andy@pileus.org>"
104 subj = "Update sfvlug.org!"
105 body = "The next SFVLUG meeting is TBA!"
106 sendmail = "/usr/sbin/sendmail '" to "'"
107 print "To: " to | sendmail
108 print "From: " from | sendmail
109 print "Subject: " subj | sendmail
111 print body | sendmail
112 say("Topic out of date, emailing " to);
116 BEGIN { pollchan = "#sfvlug" }
117 (CMD == "PING" && systime()-lastpoll > 60*60*24) ||
118 (CMD == "PRIVMSG" && /^\.poll/) {
119 if (!TOPICS[pollchan]) {
120 debug("Unknown topic for " pollchan);
121 send("TOPIC " pollchan)
124 _curl = "curl -s http://sfvlug.org/"
125 _day = "(Sun|Mon|Tue|Wed|Thu|Fri|Sat)"
126 _web_tba = "next meeting is: TBA"
127 _web_ptrn = "next meeting.*" _day "\\w+[, ]+([A-Z]\\w+) +([0-9]+)[, ]+([0-9]+)"
128 _irc_ptrn = _day "\\w*[, ]+([A-Z]\\w+) +([0-9]+)"
129 while (_curl | getline _line) {
130 #if (match(_line, _web_tba))
131 # email("Brian <brian@zimage.com>");
132 if (match(_line, _web_ptrn, _parts)) {
133 _date = _parts[1] " " _parts[2] " " _parts[3]
134 _topic = TOPICS[pollchan]
135 sub(_irc_ptrn, _date, _topic)
136 if (_topic != TOPICS[pollchan])
137 topic(pollchan, TOPICS[pollchan] = _topic)
139 debug("topic is already correct")
148 function head(cmd, var) {
153 function uptime(time, fmt) {
154 fmt = "%d:%02d:%02d:%02d"
155 fmt = "%d days %02d:%02d:%02d"
158 time / (60*60 ) % 24,
163 up_version = head("git describe --always --dirty")
164 up_author = head("git log -n1 --format=format:%an")
165 up_message = head("git log -n1 --format=format:%s")
166 up_reload = systime();
169 say("version: " up_version " - " up_author " - " up_message)
173 say("uptime: " uptime(_now - START) ", " \
174 "reload: " uptime(_now - up_reload))
179 _who = $2 ? $2 : FROM
181 say("nick=" USERS[_who]["nick"] " " \
182 "user=" USERS[_who]["user"] " " \
183 "auth=" USERS[_who]["auth"] " " \
184 "real=" USERS[_who]["real"] " " \
185 "host=" USERS[_who]["host"])
187 say("no auth info for " _who)
191 TO == NICK && /^/ { extra = "" }
192 TO == NICK && /^\.?fortune.*-o/ { extra = "-o" }
193 TO == NICK && /^\.?fortune/ {
194 gsub(/.*\.?fortune *|-[a-z]* *|[^a-zA-Z0-9 ]/, "", MSG)
195 cmd = "fortune " extra " " (MSG ? "-m '" MSG "'" : "-s")
197 while (cmd | getline _fortune && _lines < 5) {
205 /\<[Bb][Oo][Ff][Hh]\>/ {
206 _cmd = "fortune bofh-excuses"
207 _cmd | getline _fortune
208 _cmd | getline _fortune
209 _cmd | getline _fortune
218 morse[".-.-.-" ] = "."
219 morse["--..--" ] = ","
220 morse["..--.." ] = "?"
221 morse[".----." ] = "'"
222 morse["-.-.--" ] = "!"
223 morse["-..-." ] = "/"
224 morse["-.--." ] = "("
225 morse["-.--.-" ] = ")"
226 morse[".-..." ] = "&"
227 morse["---..." ] = ":"
228 morse["-.-.-." ] = ";"
229 morse["-...-" ] = "="
230 morse[".-.-." ] = "+"
231 morse["-....-" ] = "-"
232 morse["..--.-" ] = "_"
233 morse[".-..-." ] = "\""
234 morse["...-..-"] = "$"
235 morse[".--.-." ] = "@"
262 morse["-----" ] = "0"
263 morse[".----" ] = "1"
264 morse["..---" ] = "2"
265 morse["...--" ] = "3"
266 morse["....-" ] = "4"
267 morse["....." ] = "5"
268 morse["-...." ] = "6"
269 morse["--..." ] = "7"
270 morse["---.." ] = "8"
271 morse["----." ] = "9"
275 gsub(/[^.\-\/]/, " ")
277 for (i=2; i<=NF; i++)
279 _str = _str morse[$i]
283 reply("hush it, you pile of bologna")
287 AUTH == OWNER && /^go go gadget woop/ {
289 say(".delay " i " seconds; .woop " i)
293 gsub(/[^Oo]/, "", $1)
300 for (i=1; i<_len; i++)
301 _woop = _woop " " msg
305 TO == NICK && /^[Ww][Oo]+[Pp] *([0-9]*)/ {
317 TO == NICK && DST ~ /^#/ {
322 say(sprintf("Temperature: %4.1f F Humidity: %2d%%",
323 rand()*20+65, rand()*20+40))
331 say("Awk, awk, awk! I'm a bird!")
335 ((TO == NICK && /(help|halp)/) ||
336 /^[^.](help|halp)/) {
337 reply("Nothing can help you now..")
340 /(\<[Hh][Oo]\>.*){3}/ {
341 say("\00309Merry \00304Christmas!")
345 tolower($0) ~ /\<cloud\>/ {
346 _cmd = "shuf clouds.txt"
347 _cmd | getline _cloud
352 /^headshot [Cc]hristmas/ {
353 say(".load Christmas")
355 say(".unload Christmas")
358 FROM == "rhnoise" && $2 == "slaps" && $3 == NICK {
367 /(for what|that for)\?$/ {
368 say("For great justice!");
372 say("And now it's...");
373 say("Springtime for Hitler and Germany!");
377 FROM == "rhnoise" && load_mod {
378 say(".load " load_mod)
379 say("rhnoise: You slag!")
384 (TO == "rhnoise" && /^load \w+/) ||
385 (DST == "#rhniose" && /^\.load [a-z]\w+/) {
386 gsub(/[^a-zA-Z0-9_]/, " ")
387 load_mod = toupper(substr($2,1,1)) substr($2,2);
390 (DST == "#rhnoise" && /^\.line /) {
393 say("scalawag: You slag!")
396 (DST == "#rhnoise" && /^\.qdb 268$/) {
400 (DST == "#rhnoise" && /\.qdb *268/) {
411 /^\.(scores|scoreboard)$/ {
415 FROM == "rhnoise" && !length(user_scores) {
416 if (split(MSG, _parts, /, /)) {
417 for (_i=1; _i<=length(_parts); _i++) {
418 split(_parts[_i], _tmp, ": ");
419 user_scores[_i]["user"] = _tmp[1];
420 user_scores[_i]["score"] = _tmp[2];
425 length(user_scores) &&
426 tolower($0) ~ /\<nuclear launch detected\>/ {
428 for (_i=1; _i<=length(user_scores); _i++) {
429 _user = user_scores[_i]["user"];
430 _score = user_scores[_i]["score"];
431 if (_user in USERS) continue
432 if (_score == 1) { say(_user "--"); _count++; }
433 if (_score == -1) { say(_user "++"); _count++; }
439 say("looks like you're safe.. for now..");
444 DST != "#rhnoise" && /\<[a-zA-Z0-9_]{3,16}(\+\+|--)/ {
445 say("#rhnoise", "(" DST ") " FROM ": " MSG);