Like Dr. McKay said, you can use the event friendOrChatMessage to find out if someone send you a message, so you can respond to them.
I have the other method friendMessage, which will only send something back when you get a message from a friend.
// When we get a message, send back a response and log to console
client.on("friendMessage", function(steamID, message) {
console.log("Friend message from " + steamID+ ": " + message);
if (message == "Ping") {
client.chatMessage(steamID, "Pong");
console.log("Send back: Pong");
} else {
client.chatMessage(steamID, config.greetMsg);
console.log("Send back the standard reply");
}
});
});
When your bot gets the message 'Ping' it will send back 'Pong'. If your bot gets a different message, it will respond with a standard reply which you should create in your config.json file.
If you want more reply options, I'd suggest creating a switch statement with several cases.