-Insert an array of nicknames or close matches to your name. If you wanna get real technical, add a variance of one or two characters for the cases where they make a typo.
-Just get the player data of the person who sent the chat using the API, and check that their distance to you is within a desired range using Map class
-Make sure you add a reasonable (and semi random) delay in responses so you aren't having instances where you respond too fast.
-Make sure you have a large array of similar responses so that you aren't just saying the exact same things over and over. Also make sure you add repeat question detectors. What happens if someone decides to test if you're a bot by trading you or getting you to say the same thing over and over.