or maybe go with a socket for the hell of it
on $*:text:/@fortune$/iS:#: { if (!%fortuneflood) { set -u3 %fortuneflood on | if ($sock(fortune)) .sockclose fortune | .sockopen fortune www.fortunecookiemessage.com 80 | .sockmark fortune # $chr(91) $nick Here Is Your Random Fortune $chr(93) } }
on *:SOCKOPEN:fortune: { sockwrite -nt $sockname GET / HTTP/1.1 | sockwrite -nt $sockname Host: $+(www.fortunecookiemessage.com,$str($crlf,2)) }
on *:SOCKREAD:fortune: {
var %fortune | sockread %fortune
if ($regex(%fortune,/([A-z].+)<\/p>/)) { msg $sock(fortune).mark $regml(1) :Lucky Numbers: $+($r(0,20),$chr(32),$r(10,50),$chr(32),$r(30,70),$chr(32),and,$chr(32),$r(50,99).) | .sockclose fortune }
}