Per Billythekid's note, the $ in that location would indicate a regular expression match text, which the ON JOIN event does not have.
The format of that ON JOIN event is correct and limits the commands that follow it, so that they only execute when you join the channel.