instead of doing
if ($nick isop $chan) || ($nick ishop $chan) {
you can use
if ($nick(#,$nick,oh))
also maybe make the two on text events into one event.