@include "irc.awk"
@include "json.awk"
@include "spades.awk"
-#@include "email.awk"
+@include "email.awk"
# Initialization
BEGIN {
json_load("var/login.json", login);
json_load("var/nounicode.json", nounicode);
- json_load("var/nocolor.json", nocolors);
+ json_load("var/nocolor.json", nocolor);
OWNER = login["owner"];
delete login
if (FIRST) {
- join("#rhnoise")
+ join("#rhtest")
join("#rhspades")
join("#sfvlug")
}
time / (1 ) % 60)
}
BEGIN {
- up_version = head("git describe --always --dirty")
+ up_version = head("git describe --always")
+ up_dirty = head("git describe --always --dirty")
up_author = head("git log -n1 --format=format:%an")
up_message = head("git log -n1 --format=format:%s")
up_reload = systime();
}
/^\.(version|rev)/ {
- say("version: " up_version " - " up_author " - " up_message)
+ say("version: " up_dirty " - " up_author " - " up_message)
+ say("http://pileus.org/git/?p=~andy/rhawk;h=" up_version)
}
/^\.uptime/ {
_now = systime();
say("no auth info for " _who)
}
+# GeoIP Lookup
+function geoip(ip, dat, cmd, line, parts) {
+ dat = "/usr/share/GeoIP/GeoIPCity.dat"
+
+ cmd = "geoiplookup -f " dat " " ip
+ cmd | getline line
+ close(cmd)
+
+ if (split(line, parts, /[:,] /) >= 9)
+ return parts[8] "," parts[9] " -- " \
+ parts[6] ", " parts[4] ", " parts[3]
+ else
+ return "not found"
+}
+
+/^\.geoip (([0-9a-zA-Z_.-]+) *)*$/ {
+ for (_i=2; _i<=NF; _i++) {
+ if ($_i in USERS)
+ say(geoip(USERS[$_i]["host"]) " -- " \
+ $_i " -> " USERS[$_i]["host"])
+ else
+ say(geoip($_i) " -- " $_i)
+ }
+}
+
# Fortune
TO == NICK && /^/ { extra = "" }
TO == NICK && /^\.?fortune.*-o/ { extra = "-o" }
next
}
+/\<[Bb][Oo][Ff][Hh]\>/ {
+ _cmd = "fortune bofh-excuses"
+ _cmd | getline _fortune
+ _cmd | getline _fortune
+ _cmd | getline _fortune
+ close(_cmd)
+ say(_fortune)
+ next
+}
+
# Morse code
BEGIN {
morse["/" ] = " "
#say("Hello, " FROM)
}
+/^\.nestroyeti/ {
+ say(sprintf("Temperature: %4.1f F Humidity: %2d%%",
+ rand()*20+65, rand()*20+40))
+}
+
#DST != "#sfvlug" &&
!(FROM in bots) &&
CMD == "PRIVMSG" &&
say("Awk, awk, awk! I'm a bird!")
}
-!(FROM in bots) &&
-((TO == NICK && /(help|halp)/) ||
- /^[^.](help|halp)/) {
- reply("Nothing can help you now..")
-}
-
/(\<[Hh][Oo]\>.*){3}/ {
say("\00309Merry \00304Christmas!")
}
say("THE LARCH");
}
+/(for what|that for)\?$/ {
+ say("For great justice!");
+}
+
+/\<nazi/ {
+ say("And now it's...");
+ say("Springtime for Hitler and Germany!");
+}
+
# God damn commands
FROM == "rhnoise" && load_mod {
say(".load " load_mod)
# Decrementer
BEGIN {
user_scores[0] = 1;
+ delete user_scores
}
/^\.(scores|scoreboard)$/ {
}
}
+# Vote relay
+DST != "#rhnoise" && /\<[a-zA-Z0-9_]{3,16}(\+\+|--)/ {
+ say("#rhnoise", "(" DST ") " FROM ": " MSG);
+}
+
# Misc
{ fflush("") }