If moderator means 'Op' then this should not be causing your problem, because the 1st command is checking if the $nick is an Op in $chan and exiting the event handler if they are an Op. Perhaps you have another :TEXT: event in another script doing stuff too?