I recommend using $$1 in place of $1. The double $ makes it only trigger if there is a nick selected (in this case).