Added multiple hmm detection

This commit is contained in:
aewens 2018-07-17 14:20:43 -04:00
parent 5a0cc587b3
commit ed6615c238
1 changed files with 4 additions and 3 deletions

7
bot.js
View File

@ -266,16 +266,17 @@ const runLogic = (client, from, to, message) => {
message = parsedMessage[2];
}
const hmm = new RegExp(/.*hm+.*/);
const hmm = new RegExp(/(hm+)/);
const hmms = message.match(hmm);
if (message.match(hmm) && !message.startsWith("!hmmscore")) {
if (hmms && !message.startsWith("!hmmscore")) {
client.brain.memories.hmmscores = client.brain.memories.hmmscores || {};
let hmmscore = client.brain.memories.hmmscores[from];
if (!hmmscore) {
client.brain.memories.hmmscores[from] = 0;
hmmscore = 0;
}
client.brain.memories.hmmscores[from] = hmmscore + 1;
client.brain.memories.hmmscores[from] = hmmscore + hmms.length;
client.brain.remember();
}