rendered paste bodyalias c1 { return $+(10,$1-) }
alias c2 { return $+(04,$1-) }
on $*:TEXT:/^[!@.](spell|spellcheck)/Si:#: {
if (!$2) {
notice $nick $c1 $+ Syntax: $1 word
halt
}
set %output $iif($left($1,1) == @,msg $chan,notice $nick)
set %inputword $2
sockopen spell [ $+ [ %inputword ] ] www.o-ss.net 80
}
on *:SOCKOPEN:spell*: {
sockwrite -nt $sockname GET /parsers/spell.php?word= $+ %inputword HTTP/1.1
sockwrite -nt $sockname Host: www.o-ss.net
sockwrite -nt $sockname $crlf
}
on *:SOCKREAD:spell*: {
if ($sockerr) {
%output $c1(An error has occured while connecting. Please try again later.)
unset %inputword
unset %output
sockclose $sockname
halt
}
var %spelltext
sockread %spelltext
if (*[SPELL]* iswm %spelltext) {
tokenize 32 %spelltext
if (*word is correct* iswm $1-) {
%output $c1(The word ') $+ $c2(%inputword) $+ $c1(' is spelled correctly.)
unset %inputword
unset %spelltext
unset %output
sockclose $sockname
halt
}
%output $c1(The word ') $+ $c2(%inputword) $+ $c1(' is spelled incorrectly. Here is a suggestion:) $c2($2) $+ $c1 $+ .
unset %inputword
unset %output
unset %spelltext
sockclose $sockname
}
}