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,&nbsp;,$chr(160),&quot;,",&lt;,<,&gt;,>,&amp;,&,&hellip;,...,&reg;,®,&copy;,©,,&trade;,?,&frac14;,¼,&frac12;,½,&frac34;,¾,&sup3;,³,&sup2;,²,&deg;,°,&bull;,?,&rsaquo;,?,&lsaquo;,?,&raquo;,»,&laquo;,&rsquo;,?,&lsquo;,?,&rdguo;,?,&ldquo;,?,&ndash;,?,&mdash;,?,&apos;,',&tilde;,~,&times;,×,&divide;,÷,&para;,¶,&ecute;,é,&Ecute;,É,&cent;,¢,&pound;,£,&yen;,¥,&sect;,§)
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
}
}

Comments

Sign in to comment.
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.