irc-bot/spells/botlist.js

45 lines
1.2 KiB
JavaScript

// To adhere to https://tilde.team/wiki/?page=irc-bots
module.exports = class BotList {
constructor(client, from, to, incantation) {
this.name = "BotList";
this.client = client;
this.summoner = from;
this.channel = to;
this.incantation = incantation;
this.spell = "lerta bots";
this.cheatCode = "botlist";
this.varsUsed = 0;
this.casted = false;
this.locked = false;
}
test() {
if (this.incantation === this.spell) {
this.casted = true;
return this.cast();
}
return { say: false };
}
cast() {
let response = {
say: false,
debug: {},
content: ""
};
const author = this.client.config.author;
const email = this.client.config.email;
const maker = `${author} <${email}>`;
const triggerNames = Object.keys(this.client.triggers);
let botlist = `${this.client.config.botName} | ${maker}`;
botlist = `${botlist} | the Esperanto speaking chat bot`;
botlist = `${botlist} | ${triggerNames.join(", ")}`;
response.say = true;
response.content = botlist;
return response;
}
}