52 lines
1.4 KiB
JavaScript
52 lines
1.4 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) {
|
|
// Only the author can use these spells
|
|
if (this.locked && this.summoner !== this.client.config.author) {
|
|
const say = "Blasfemo! That spell is forbidden to you."
|
|
this.client.say(this.channel, say);
|
|
return false;
|
|
}
|
|
|
|
this.casted = true;
|
|
return this.cast.apply(this, arguments);
|
|
}
|
|
|
|
return { say: false };
|
|
}
|
|
|
|
cast(user) {
|
|
let response = {
|
|
say: false,
|
|
debug: {},
|
|
content: ""
|
|
};
|
|
|
|
if (!user) {
|
|
user = this.summoner;
|
|
}
|
|
|
|
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;
|
|
}
|
|
} |