BOFH Excuse Bot Code Thingy
Platform: mIRC
Published Jul 19, 2012
Updated Jul 19, 2012
This is a simple script using sockets and an HTMLFree alias to pull BOFH-style computer problem excuses from
http://pages.cs.wisc.edu/~ballard/bofh/bofhserver.pl.
It goes in your bot's remotes, and the trigger in-channel is "!bofh".
Also, you must change "***CHANGE ME HERE***" to your channel.
on *:TEXT:!bofh*:***CHANGE ME HERE***: {
/bofhget
/set %bofhchan $chan
}
alias bofhget {
/sockopen bofh pages.cs.wisc.edu 80
}
alias htmlfree {
var %x, %i = $regsub($replace($1-,<br>,$crlf),/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $replace(%x, ,$chr(160),",",<,<,>,>,&,&,…,...,®,®,©,©,,™,?,¼,¼,½,½,¾,¾,³,³,²,²,°,°,•,?,›,?,‹,?,»,»,«,’,?,‘,?,&rdguo;,?,“,?,–,?,—,?,',',˜,~,×,×,÷,÷,¶,¶,&ecute;,é,&Ecute;,É,¢,¢,£,£,¥,¥,§,§)
return $regsubex(%x,/&#(\d+);/ig,$chr(\1))
}
ON *:sockopen:bofh: {
/sockwrite -nt $sockname GET /~ballard/bofh/bofhserver.pl HTTP/1.1
/sockwrite -nt $sockname Host: pages.cs.wisc.edu
/sockwrite -nt $sockname $crlf
}
ON *:sockread:bofh: {
if ($sockerr) { echo -a SOCKET ERROR: $sockerr }
/var %bofhsocktext
/sockread %bofhsocktext
/set %bofhsocktext $htmlfree(%bofhsocktext)
if (*The cause of the problem is* iswm %bofhsocktext) {
tokenize 32 %bofhsocktext
/msg %bofhchan The computer problem $12-
/sockclose bofh
}
}