on $*:text:/^[.!@]fact$/:#:{
if !%t [ $+ [ $wildsite ] ] {
inc -u5 $+(%,t,$wildsite) | $fact
}
}
alias fact {
$+(sock,$iif($sock(f),close,$&
open f www.randomfunfacts.com 80))
sockmark f msg #
}
on *:sockopen:f:{
var %f sockwrite -n f
%f GET / HTTP/1.1
%f Host: $sock(f).addr
%f $crlf $crlf
}
on *:sockread:f:{
var %f | sockread %f
$iif($regex(%f,/<i>(.*)</i>/),$&
$token($sock(f).mark,1-2,32) $regml(1))
}
For your own use, enter: > /fact
For other people to trigger, enter: > !fact, .fact or @fact
!fact Only two people signed the Declaration of Independence on July 4th, John Hancock and Charles Thomson. Most of the rest signed on August 2, but the last signature wasn't added until 5 years later. !fact In 1976, the 10 billionth gallon of "Coca-Cola" syrup was produced. !fact Armadillos, opossums, and sloth's spend about 80% of their lives sleeping. !fact The highest paid CEO in 2004 was Terry Semel of Yahoo. He earned $230 million, or approximately $630,000 per day.