as stated before a socket would be better then a huge txt file
you could do something like this..
on $*:text:/^!chuck$/iS:#: {
if ($sock(chuck)) sockclose chuck
sockopen chuck www.ninjadude.com 80
sockmark chuck msg #
}
on *:sockopen:chuck: {
sockwrite -nt $sockname GET /chuck-norris-facts-generator.php HTTP/1.1
sockwrite -nt $sockname Host: $+(www.ninjadude.com,$str($crlf,2))
}
on *:sockread:chuck: {
var %chuck | sockread %chuck
if ($regex(%chuck,/<font.+>(.+)/)) {
$sock(chuck).mark $regml(1)
sockclose chuck
}
}
or if you want to use 4q.cc web site for the chuck facts
on $*:text:/^@chuck$/iS:#: {
if ($sock(cu)) sockclose cu
sockopen cu 4q.cc 80
sockmark cu msg #
}
on *:sockopen:cu: {
sockwrite -nt $sockname GET /index.php?pid=fact&person=chuck HTTP/1.1
sockwrite -nt $sockname Host: $+(4q.cc,$str($crlf,2))
}
on *:sockread:cu: {
var %cu | sockread %cu
if ($regex(%cu,/\t{3}(\w.+)<\/div>/)) {
$sock(cu).mark $replace($regml(1),",')
sockclose cu
}
}