Why make all those checks? It's a lot easier to do this
ON @*:TEXT:*:#:{
if ($nick isreg $chan) { swearcheck $nick $chan $1- }
}
ON @*:ACTION:*:#:{
if ($nick isreg $chan) { swearcheck $nick $chan $1- }
}
The
@ prefix means it will not trigger unless you (or the person running the script) are opped.
isreg will make it trigger only if the user is not voiced or opped.