I suggest changing it to ($chan != #channel) && ($chan !isactive)

That way the script won't process the additional message for the channel you are currently chatting in.