lol i didnt see that he used $nick . don't know why they used $nick maybe a typo?
anyways the way i did it is it wont work unless #chan_name is added ex @join #Chan_Name and @part #Chan_Name