Fixed bug in whois

This commit is contained in:
aewens 2018-07-31 11:47:14 -04:00
parent 036794e50a
commit 2d283cf240
1 changed files with 13 additions and 2 deletions

View File

@ -47,8 +47,19 @@ module.exports = class Whois {
"Authorization": `${apiKey}`
}
}).then((res) => {
const status = res.data.registrar.id ? "registered" : "available";
self.client.say(self.channel, `${domain} is "${status}"`);
// const data = JSON.stringify(res.data);
// console.log(`${self.name} :: ${data}`);
const nameservers = res.data.nameservers.length;
const registrar = res.data.registrar;
const registered = res.data.registered;
if (registered) {
const logic = registrar.id || nameservers > 0;
const status = logic ? "registered" : "available";
self.client.say(self.channel, `${domain} is "${status}"`);
} else {
const zipper = `${this.summoner}, vi zipro, ${domain}`;
self.client.say(self.channel, `${zipper} is not a domain!`);
}
}).catch((error) => {
const zipper = `${this.summoner}, vi zipro, ${domain}`;
self.client.say(self.channel, `${zipper} cannot exist!`);