irc-bot/spells/hmm.js

41 lines
1.0 KiB
JavaScript

// Because freeappsw
module.exports = class Hmm {
constructor(client, from, to, incantation) {
this.name = "Hmm";
this.client = client;
this.summoner = from;
this.channel = to;
this.incantation = incantation;
this.spell = "hmm poentaro";
this.cheatCode = "hmmscore";
this.varsUsed = 1;
this.casted = false;
this.locked = false;
}
test() {
if (this.incantation === this.spell) {
this.casted = true;
return this.cast.apply(this, arguments);
}
return { say: false };
}
cast(user) {
let response = {
say: false,
debug: {},
content: ""
};
const memories = this.client.brain.memories;
memories.hmmscores = memories.hmmscores || {};
const hmmscore = memories.hmmscores[user] || 0;
response.say = true;
response.content = `Hmm score for "${user}": ${hmmscore}`;
return response;
}
}