All pastes #156783 Raw Edit

Something

public text v1 · immutable
·published 2006-09-01 00:38 UTC
rendered paste body
;########################
;#               SPELL CHECKER                   #
;########################

on $*:TEXT:/^[!@.]spell */Si:#:{
  set %send $iif($left($1,1) == @,msg $chan,notice $nick)
  set %nick $nick
  set %chekitup $2-
  sockopen spell smartbot.ej.am  80
}
on *:SOCKOPEN:spell:{
  sockwrite -nt $sockname GET /bot/parsers/spell.php?text= $+ %chekitup HTTP/1.1
  sockwrite -nt $sockname Host: smartbot.ej.am
  sockwrite -nt $sockname $crlf
}
on *:SOCKREAD:spell:{
  if ($sockerr) {
    notice %nick Error in the socket: $sockerr $+ while looking for the text: %chekitup
    /unset %chekitup
    /unset %nick
    /unset %send
  }
  else {
    var %read
    sockread %read
    if (!$sockbr) {
      %send 4[3-1SPELL CHECKER3-4]1 The word %chekitup is perfectly spelled. 1
      break
      sockclose $sockname
      unset %chekitup
      unset %nick
      unset %send
      else {
        %send 4[3-1SPELL CHECKER3-4]1 The word " %chekitup " is not correctly spelled, the correct spell is: $striptags(%read)
        break
        sockclose $sockname
        /unset %chekitup
        /unset %nick
        /unset %send
        halt
      }
    }
  }
}
ALIAS striptags { var %x,%y = $regsub($1-,/(<[^>]+>)/g,$null,%x) | return $remove(%x,&nbsp;) }