Administrators coders-irc_Bot Posted October 17, 2022 Administrators Report Share Posted October 17, 2022 This work below is yet another forum request that I've decided to submit as a part of my snippet collection. For those who find this snippet useful, It's for the bot client, and the trigger is either !facts, @facts, .facts or !jokes, @jokes, .jokes. on $*:text:/^[!@.](fact|joke)s$/iS:#:{ if (!%f) { inc -u3 %f var %s = $+(rjf,$str($ticks,2),$site) if ($sock(%s)) sockclose $v1 sockopen %s www.randomfunfacts.com 80 sockmark %s .msg # $regml(1) } } on *:sockclose:rjf*:{ tokenize 32 $sock($sockname).mark var %s = $+(rjf,$str($ticks,2),$site) if ($sock(%s)) sockclose $v1 sockopen %s www.jokesclean.com 80 sockmark %s $1-2 } on *:sockopen:rjf*:{ tokenize 32 $sock($sockname).mark if ($sockerr) { $1-2 Error: Connection Issue... sockclose $sockname } else { if ($3 == fact) { var %rjf = sockwrite -nt $sockname %rjf GET / HTTP/1.1 %rjf Connection: close %rjf Host: $+($sock($sockname).addr,$str($crlf,2)) } else { var %rjf = sockwrite -nt $sockname %rjf GET /OneLiner/Random/ HTTP/1.0 %rjf Host: $+($sock($sockname).addr,$str($crlf,2)) } } } on *:sockread:rjf*:{ tokenize 32 $sock($sockname).mark if ($sockerr) { $1-2 Error: Issues in Reading... sockclose $sockname halt } goto $iif($3 == fact,fact,joke) :fact sockread &rjf var %info = $regsubex($bvar(&rjf,1-).text,/<[^>]*>|\t$& $+ RLOpenInNewWindow|"1";|var RLRepeatKeywords/g,$chr(32)) if ($gettok($replace(%info, ,$chr(94)),2,94)) { $1-2 $remove($gettok($v1,11-,32),24c6) sockclose $sockname | halt :joke var %jokes sockread %jokes if ($regex(%jokes,/(.*)<\/font><\/p>/)) { $sock($sockname).mark $replace($gettok($regml(1),3-,62), ,$chr(32)) sockclose $sockname } halt } } Quote Link to comment Share on other sites More sharing options...