Not really an answer, but here's a small code I use on my bot to prevent chat spam. It will block a person who send same messages every 2 second.
var antispam;
var markedSteamID;
function spamtimer() { //when called, it will reset
antispam = 0;
markedSteamID = 0;
}
setInterval(spamtimer, 2000); //call spamtimer function every 2 sec
//.. your code here
client.on("friendMessage", function(senderID, message) {
//anti spam
if (senderID == admin){
//Ignore if chat from admin
}
else if ((antispam == message) && (markedSteamID == senderID.getSteamID64())) {
client.chatMessage(senderID, "I caught you spamming");
//do something, like block that person or something
}
//.. your code here.. to respond chat
antispam = message; //bot will record the message, will reset every 2 sec
markedSteamID = senderID.getSteamID64(); //bot will record SteamID of sender, will reset every 2 sec
});