napa182 commented on a Page, Fortune teller Script V 1.0  -  May 04, 2009

another way of doing this code is a socket. This is only an example! I know that Weasel would have no clue how to make a socket but il post this as a comment anyways. So again this is only a example:

on $*:text:/@fortune$/iS:#: { if (!%fortuneflood) { set -u3 %fortuneflood on | if ($sock(fortune)) .sockclose fortune | set %fortune.chan.nick $chan $nick | .sockopen fortune www.fortunecookiemessage.com 80 } }
on *:sockopen:fortune: { sockwrite -nt $sockname GET / HTTP/1.1 | sockwrite -nt $sockname Host: www.fortunecookiemessage.com | sockwrite -nt $sockname $crlf }
on *:sockread:fortune: {
  var %fortune | sockread %fortune
  if ($regex(%fortune,/(\w.+)<\/p>/)) { msg $gettok(%fortune.chan.nick,1,32) 14[04 $gettok(%fortune.chan.nick,2,32) Here Is Your Random Fortune 14] $regml(1) | unset %fortune.chan.nick | .sockclose fortune }
}
 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.