57 lines
1.5 KiB
JavaScript
57 lines
1.5 KiB
JavaScript
const fs = require("fs");
|
|
|
|
// Used to allow the author to manually banish someone
|
|
module.exports = class Banish {
|
|
constructor(client, from, incantation) {
|
|
this.name = "Banish";
|
|
this.client = client;
|
|
this.summoner = from;
|
|
this.incantation = incantation;
|
|
this.spell = "malpermesi";
|
|
this.cheatCode = "banish";
|
|
this.casted = false;
|
|
this.varsUsed = 2;
|
|
this.locked = true;
|
|
}
|
|
|
|
test() {
|
|
if (this.incantation === this.spell) {
|
|
this.casted = true;
|
|
return this.cast();
|
|
}
|
|
|
|
return { say: false };
|
|
}
|
|
|
|
cast(user, reason) {
|
|
let response = {
|
|
say: false,
|
|
debug: {},
|
|
content: ""
|
|
};
|
|
|
|
const subject = "You have been summoned!";
|
|
const text = `Summoning request performed by ${this.summoner}`;
|
|
|
|
this.transporter.sendMail({
|
|
to: this.client.email,
|
|
subject: subject,
|
|
text: text
|
|
}, (err, info) => {
|
|
console.log("Summon::email", info);
|
|
response.debug.email = info;
|
|
});
|
|
|
|
this.pusher.note(this.client.device, subject, text, (err, info) => {
|
|
console.log("Summon::pusher", info);
|
|
response.debug.pusher = info;
|
|
});
|
|
|
|
const success = `Superba ${this.summoner}! You have summoned`;
|
|
|
|
response.say = true;
|
|
response.content = `${success} ${this.client.config.author}!`;
|
|
|
|
return response;
|
|
}
|
|
} |